Mailing List Archive


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

Re: [tlug] Bashing away at Unix



On Tue, Mar 18, 2008 at 09:32:20AM +0100, Attila Kinali wrote:
> On Mon, 17 Mar 2008 21:11:01 +0900
> Dave Brown <dagbrown@example.com> wrote:
> 
> > On Fri, Mar 14, 2008 at 10:53:51PM -0800, SL Baur wrote:
> > > You did not mention white space protection - use of "$@", 
> > 
> > Don't you mean "${1+$@example.com"?
> 
> What the heck does that do?

I actually fatfingered it.  It should be:

    ${1+"$@"}

Which is an overparanoidism for "$@".  Some ancient Bourne shells, upon
being presented with "$@" and no actual arguments, will expand that as
"" and not, as you might hope, an empty list.

So ${1+"$@"} tests to see if $1 is non-null, and if so, expands "$@".

--Dave


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links