🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #1135

Re: bug in /bin/sh

#1135
From: daniel.r.levy
Date: Thu, 25 May 1989 23:20
16 lines
1135 bytes
In article <1011@cbnewsc.ATT.COM> I wrote:
< < 			$ mail() /usr/bin/mailx $*

< Use "$@" [sic, including the double quotes] instead of $*.  $* re-formats the
< arguments into individual tokens.

Since you might want to invoke this without arguments at all, use ${1+"$@"}
which will expand to nothing if there are no arguments.  Otherwise,
/usr/bin/mailx will see one null argument if there are no arguments
passed to the function, and won't do what you want it to.
-- 
Dan'l Levy                 UNIX(R) mail:  att!ttbcad!levy, att!cbnewsc!danl
AT&T Bell Laboratories
5555 West Touhy Avenue     Any opinions expressed in the message above are
Skokie, Illinois  60077    mine, and not necessarily AT&T's.
Technical Details
Message-ID: <1014@cbnewsc.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!att!cbnewsc!danl
References: <883@cetia4.UUCP> <1011@cbnewsc.ATT.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!att!cbnewsc!danl
From: danl@cbnewsc.ATT.COM (daniel.r.levy)
Newsgroups: comp.bugs.sys5
Subject: Re: bug in /bin/sh
Summary: oops -- ${1+"$@"} better than "$@"
Keywords: functions, quotes
Message-ID: <1014@cbnewsc.ATT.COM>
Date: 25 May 89 23:20:46 GMT
References: <883@cetia4.UUCP> <1011@cbnewsc.ATT.COM>
Organization: AT&T Bell Laboratories
Lines: 16