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

Re: Simple shell scripting question from a newbie.

On 04-Feb-04, 00:28 (CST), Lex Hider <alexeijh@pacific.net.au> wrote: 
> So please be nice if this is a really dumb question.

It's not a dumb question, but it might be better asked on debian-users.

> Is a piece of code like the following...
> while [ x"$1" != x ]; do
> 	...
> done
> the same as using the -z flag for test.


> It just looks like a weird way of doing things that occur frequently.

The -z test is a relatively new addition (well, considering that the
original bourne shell is ~25 years old :-)), so out of habit or concern
for portability (the Sun Solaris /bin/sh doesn't support -z) people
still use the [ x"$1" != x] form.


Steve Greenland
    The irony is that Bill Gates claims to be making a stable operating
    system and Linus Torvalds claims to be trying to take over the
    world.       -- seen on the net

Reply to: