Is quoting necessary in /etc/rc.conf ?
freebsd at edvax.de
Sun Aug 6 13:31:41 UTC 2017
On Sun, 6 Aug 2017 11:00:03 +0000, Manish Jain wrote:
> On my system, it works whether I put either of the following in rc.conf:
> Just wished to check whether an unquoted YES is completely equivalent
> (and accepted) as a quoted YES ?
Keep in mind /etc/rc.conf is basically a sh script. So the
quoting rules of sh apply, and especially for the values YES
and NO, it's completely equivalent.
The general form is NAME=VALUE, and if VALUE contains spaces,
quoting is needed, except you escape spaces. So
is totally valid (no spaces), while both
is valid as well (with spaces).
If VALUE contains the $ sign or other special characters that
might cause interpretation by /bin/sh at "parsing time", using
the single quotes is possible:
For empty values, using
looks "more logical", as "the empty value" can clearly be seen,
instead of just missing the right-hand side of the association.
In order to avoid confusion, using quotes for all arguments is
suggested as per /etc/defaults/rc.conf ("system standard"), and
this consistent form - even for the values that don't _require_
quotes, provides a clean view of that configuration file.
That said, sticking with the "system standard" is never wrong. :-)
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions