bug-bash
[Top][All Lists]
Advanced

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

"$@" vs. nounset


From: Yang Zhang
Subject: "$@" vs. nounset
Date: Mon, 29 Jun 2009 01:54:52 -0700
User-agent: Thunderbird 2.0.0.22 (Windows/20090605)

Hi, I like using nounset for stricter scripts, but an annoyance is that anytime I use "$@" and it's empty, I get an error, when (to me, cognitively) it is not "unset" (as in someone *forgot* to set it), it's just an empty, which is a common case (IIRC, in bash, variables set to empty arrays and unset variables are the same).

As a result I'm forced to use "${@:-}" or something like that everywhere I use "$@" (which is really everywhere). Is there any other way around this? Any way to get a more selective nounset? Thanks in advance.
--
Yang Zhang
http://www.mit.edu/~y_z/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]