1

What does ${1+"$@"} mean in a shell script, and how does it differ from "$@"?

view story
linux-howto

http://unix.stackexchange.com – In the Perl documentation, perlrun(1) suggests launching Perl scripts using a bilingual shell/Perl header: #!/bin/sh #! -*-perl-*- eval 'exec perl -x -wS $0 ${1+"$@"}' if 0; What does ${1+"$@"} mean? I tried using "$@" instead (using Bash as /bin/sh), and it seems to work just as well. Edit Two answers below say that it's supposed to be ${1:+"$@"}. I am aware of the ${parameter:+word} ("Use Alternate Value") syntax documented in bash(1). However, I am unconvinced, because Both ${1+"$@"} and "$@" work just fine, even when there are no parameters. If I create simple.sh as #!/bi (HowTos)