Fun with sysrc(8). Tested on
Testing commences (yes, spelling errors are intentional)
Why doesn't this tool work on arbitrary configuration files? And why does it behave in this way when variables exist (no matter what they are named.
Code:
tingo@kg-core1$ uname -a
FreeBSD kg-core1.kg4.no 10.3-STABLE FreeBSD 10.3-STABLE #0 r310083: Wed Dec 14 21:00:13 CET 2016
root@kg-core1.kg4.no:/usr/obj/usr/src/sys/GENERIC amd64
Code:
tingo@kg-core1$ mkdir sysrc-testing
tingo@kg-core1$ cd sysrc-testing
tingo@kg-core1$ l
./ ../
tingo@kg-core1$ touch ./test.conf
tingo@kg-core1$ ls -l test.conf
-rw-r--r-- 1 tingo users 0 Jan 25 18:12 test.conf
tingo@kg-core1$ sysrc -f ./test.conf kerm.maxswzone=262144
kerm.maxswzone: ->
tingo@kg-core1$ cat ./test.conf
kerm.maxswzone="262144"
tingo@kg-core1$ sysrc -f ./test.conf kerm.maxswzone
sysrc: unknown variable 'kerm.maxswzone'
tingo@kg-core1$ sysrc -f ./test.conf kern.maxswzone=38432568
kern.maxswzone: ->
tingo@kg-core1$ sysrc -f ./test.conf kern.maxswzone
sysrc: unknown variable 'kern.maxswzone'
tingo@kg-core1$ sysrc -f ./test.conf kern.maxswzone=
kern.maxswzone: ->
tingo@kg-core1$
tingo@kg-core1$ cat ./test.conf
kerm.maxswzone="262144"
kern.maxswzone="38432568"
kern.maxswzone=""