Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
As I see ${1+"$@"} can be simplified to "$@". The only difference is that in the first case only $1 will be checked whether it is set.
Yes, that's my idea as well. If there's at least one argument, $1 is set and ${1+"$@"} first expands to "$@" which then expands to $1 $2 $3 .... If $1 isn't set ${1+"$@"} expands to nothing. In either case, it's the same as "$@". There might be some shell somewhere that makes a difference, but according my reading of a manual found on the Interwebs, even in the Bourne Shell on System 7 both ${1+"$@"} and "$@" are identical. The POSIX standard also says that in the absence of positional parameters, "$@" expands to nothing.
I'm not really knowledgeable in the c shell, so I can't explain now the gubbin designed for sh and csh at the same time.
I'd be surprised if the gubbin actually worked on csh. AFAIK, it doesn't do ${foo+bar} style parameter expansion (but I don't have a csh laying around to try it on).

Perhaps the ${1+"$@"} is just a piece of cargo cult. Noone is really sure if it's going to break on some system somewhere, and just leaves it as is, instead of replacing it with "$@". It's not that there's a huge savings.

In reply to Re^2: Running Under Some Shell by JavaFan
in thread Running Under Some Shell by Xiong

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (12)
    As of 2015-03-31 09:01 GMT
    Find Nodes?
      Voting Booth?

      When putting a smiley right before a closing parenthesis, do you:

      Results (661 votes), past polls