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

Re: Simple shell scripting question from a newbie.



Scripsit zweije@xs4all.nl (Vincent Zweije)

> ||  > while [ x"$1" != x ]; do
> ||  > 	...

> I would write [ "${1:+x}" ], or rather even [ "${1+x}" ], distinguishing
> empty and undefined.

Wouldn't work. Most shells (and /bin/['s) are fine with empty
arguments, but some get confused if the first character of the
argument is a dash, such that it can be interpreted as an option.
Hence the 'x' in front.

-- 
Henning Makholm            "And why should I talk slaves' and fools' talk? I
                       don't want him to live for ever, and I know that he's
                   not going to live for ever whether I want him to or not."



Reply to: