[EMAIL PROTECTED] writes:

> Hi all,
>
> In order to avoid using undefined variables one can use the syntax:
> echo ${badvarname:?}  which will result in error message would the
> variable be bad (not "defined" or empty). This kind of reference is
> tedious therefore one could use ksh -u (in a script)
> #!/bin/ksh -u
>
> the result is a check upon all variable references, which brings in a new 
> problem. 
>
> while ($1)

Did you mean,

while test $1

?

> do
>   some stuff with $1
>   shift
> done
>
> is there a solution for such a case?

Yes, use ${badvarname:?} where appropriate...

Your question seems contradictory to me: on the one hand, you want to
exit the shell if *any* of the variables you use is unset. On the
other hand, in your example your logic *relies* on a variable being
not set.

-- 
Oleg Goldshmidt | [EMAIL PROTECTED] | http://www.goldshmidt.org

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to