Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Aug 2017 15:08:12 +0300
From:      Esa Karkkainen <ekarkkai@pp.htv.fi>
To:        freebsd-questions@freebsd.org
Subject:   Re: Is quoting necessary in /etc/rc.conf ?
Message-ID:  <20170806120812.GE51805@pp.htv.fi>
In-Reply-To: <VI1PR02MB120082575A858DA8685A40A0F6B40@VI1PR02MB1200.eurprd02.prod.outlook.com>
References:  <VI1PR02MB120082575A858DA8685A40A0F6B40@VI1PR02MB1200.eurprd02.prod.outlook.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170806120812.GE51805>