cadphile has asked for the wisdom of the Perl Monks concerning the following question:
#!/bin/sh -- # -*- perl -*-
eval 'exec /data/local/bin/perl -S $0 ${1+"$@"}'
if $running_under_some_script;
So, why ${1+"$@"} instead of just "$@"? I know that "$@" expands to all the arguments quoted (e.g. "$1" "$2", etc). But the other form I don't quite see. I mean, what's the 1+ do? I've searched the for the documentation on what this extra bracketed format accomplishes, and I can't find it. And surprisingly, Google can't handle that search string.
If someone knows the answer, or an online reference to this, I'd be very happy...
cheers!
-cadphile...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: what's the difference between "$@" and ${1+"$@"}
by merlyn (Sage) on Oct 05, 2007 at 23:47 UTC | |
by tye (Sage) on Oct 06, 2007 at 01:49 UTC | |
by cadphile (Beadle) on Oct 09, 2007 at 16:56 UTC | |
by ikegami (Patriarch) on Oct 09, 2007 at 17:05 UTC | |
by cadphile (Beadle) on Oct 11, 2007 at 22:39 UTC | |
|
Re: what's the difference between "$@" and ${1+"$@"}
by liverpole (Monsignor) on Oct 05, 2007 at 23:44 UTC |