Re: /etc/shells management
On Sun, Sep 07, 2003 at 11:58:03AM -0500, Steve Langasek wrote:
> On Sun, Sep 07, 2003 at 06:08:06PM +0200, Thomas Hood wrote:
> > On Sun, 2003-09-07 at 17:23, Branden Robinson wrote:
> > > Man, that's ugly. I use:
> > >
> > > if [ -n "$var" ]; then
> > > fi
>
> > I have been using
> >
> > if [ "$var" ]; then
> > fi
>
> > I hope that's kosher too; otherwise I have a few scripts to fix.
>
> 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.
Cheers,
--
Colin Watson [cjwatson@flatline.org.uk]
Reply to: