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

Re: Simple shell scripting question from a newbie.



On Wed, Feb 04, 2004 at 05:28:27PM +1100, Lex Hider wrote:
> Hi,
> 
> Been looking through the various shell scripts that make up Debian as a 
> way to learn bash & perl scripting.
> So please be nice if this is a really dumb question.
> 
> 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.
> 
> Please explain.

Don't take this as gospel, but I've seen it around a lot too, particularly
in older-school shell scripts. I'm guessing it was done before the -z test
existed or something...

Andrew



Reply to: