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

Re: /etc/shells management



On Mon, Sep 08, 2003 at 03:42:06AM -0500, Branden Robinson wrote:
> On Sun, Sep 07, 2003 at 06:59:18PM +0100, Colin Watson wrote:
> > On Sun, Sep 07, 2003 at 11:58:03AM -0500, Steve Langasek wrote:
> > > In general, no.  If the contents of $var are a test operator, you'll get
> > > a syntax error.
> > 
> > POSIX requires this not to be the case, because of the argument-counting
> > algorithm that 'test' is supposed to follow. See
> > http://www.opengroup.org/onlinepubs/007904975/utilities/test.html.
> 
> But if $var contains more than one shell word...
> 
> You might get different results dependening on whether you remember to
> quote the shell variable or not.

Whoa. You don't reflexively quote shell variables and have to think
about when *not* to quote them? :) Certainly, if you leave the variables
unquoted, 'test -n $var' is hardly any more reliable than just 'test
$var', and I would trust neither against hostile input.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: