Subject: Re: CVS commit: src/etc/rc.d
To: Christos Zoulas <christos@astron.com>
From: Matthias Scheler <tron@NetBSD.org>
List: source-changes
Date: 02/15/2007 17:44:06
On Thu, Feb 15, 2007 at 04:54:23PM +0000, Christos Zoulas wrote:
> In article <20070215132736.3089C2150A@cvs.netbsd.org>,
> Matthias Scheler  <tron@netbsd.org> wrote:
> >
> >Module Name:	src
> >Committed By:	tron
> >Date:		Thu Feb 15 13:27:36 UTC 2007
> >
> >Modified Files:
> >	src/etc/rc.d: perusertmp
> >
> >Log Message:
> >Remove unnessary "if [ X"$foo" ... ]" hack which is not necessary if
> >you quote things properly which this script does.
> >
> 
> quoting does not help you if the variable expansion ends up starting
> with "-".

Works for me:

tron@colwyn:~>cat tt
#!/bin/sh
if [ "$1" = "-foo" ]
then
        echo equal
else
        echo not equal
fi
tron@colwyn:~>./tt -foo
equal
tron@colwyn:~>./tt foo 
not equal

Even Solaris old fashioned "/bin/sh" doesn't need the X$VARNAME case.

	Kind regards

-- 
Matthias Scheler                                  http://zhadum.org.uk/