Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/etc/rc.d



On Thu, Feb 15, 2007 at 04:54:23PM +0000, Christos Zoulas wrote:
> In article <20070215132736.3089C2150A%cvs.netbsd.org@localhost>,
> Matthias Scheler  <tron%netbsd.org@localhost> 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/



Home | Main Index | Thread Index | Old Index