Is quoting necessary in /etc/rc.conf ?
Esa Karkkainen
ekarkkai at pp.htv.fi
Sun Aug 6 12:17:49 UTC 2017
On Sun, Aug 06, 2017 at 11:00:03AM +0000, Manish Jain wrote:
>
> Hi,
Hi,
> On my system, it works whether I put either of the following in rc.conf:
>
> xyz_enable="YES"
>
> Or,
>
> xyz_enable=YES
>
The "xyz_enable" shell environment variable is most likely checked by
checkyesno function, which is sourced from /etc/rc.subr file.
> Just wished to check whether an unquoted YES is completely equivalent
> (and accepted) as a quoted YES ?
When the environment variables value does not contain certain
characters, like a space, then there is no functional difference
betwween a quoted YES and a nonquoted YES strings, in this case.
The shells use space as argument separator. Below is a simple shell
script that shows the number of arguments given to it.
$ cat demo.sh
#!/bin/sh
echo $#
There are five examples:
$ ./demo.sh "YES"
1
$ ./demo.sh YES
1
$ ./demo.sh "NO"
1
$ ./demo.sh NO
1
$ ./demo.sh "YES NO"
1
$ ./demo.sh YES NO
2
Esa
--
"In the beginning the Universe was created. This has made a lot of
people very angry and been widely regarded as a bad move."
-- Douglas Adams 1952 - 2001
More information about the freebsd-questions
mailing list