bug-bash
[Top][All Lists]
Advanced

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

Re: alias for commands broken in bash 2.05.0


From: Paul Jarc
Subject: Re: alias for commands broken in bash 2.05.0
Date: Wed, 08 Aug 2001 11:07:33 -0400
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7

"Noel L Yap" <yap_noel@jpmorgan.com> writes:
> What does ${1+"$@"} do?  Or, better yet, can you point me to a URL
> or info file that describes it?

In the case of bash, it's the same as "$@".  But some other shells
expand "$@" to "" (a single empty string) when there are no arguments;
all shells expand ${1+"$@"} to nothing when there are no arguments, so
it's a good habit to get into.  From the bash man page:
       bash tests for a parameter that is unset or null; omitting the
       colon results in a test only for a parameter that is unset.
...
       ${parameter:+word}
              Use  Alternate  Value.   If  parameter  is  null or
              unset, nothing is substituted, otherwise the expan­
              sion of word is substituted.

So if $1 is set (possibly empty), you get "$@"; otherwise, you get
nothing.


paul



reply via email to

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