Subject: Re: Qs re pkgsrc/mk/install/usergroup
To: Georg Schwarz <georg.schwarz@freenet.de>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 03/28/2005 15:51:07
Georg Schwarz wrote:
>>>- would it be a good idea to enclose variables in case expressions by
>>>double quotes? 
>>
>>I haven't seen any guidelines on this, and I don't have any experience 
>>with shell scripting on non-NetBSD systems, so I just went with what 
>>worked on NetBSD.  If there are style guides that recommend this, please 
>>feel free to add the appropriate quotes to the scripts.
> 
> 
> Things like
> 
> [ -r $a ]
> or
> case $a
> 
> fail with some systems' shells if $a is empty. In any case I have been told
> the result is undefined. Therefore it is saver to enclose such variables in
> quotes.

I'm aware that "[ -r $a ]" fails if $a is empty (it does so on NetBSD), 
but I'm not aware of this problem for "case $a" (it works on NetBSD). 
However, as I said before, if you know that this will indeed be a 
problem on some platforms, please feel free to add the appropriate 
quotes to the script.

	Cheers,

	-- Johnny Lam <jlam@NetBSD.org>