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

Re: Package maintainer script policy.

Manoj Srivastava <srivasta@datasync.com> writes:

> [ `$@' vs. `${1+"@$"}' ]

I've since checked my books (usually a good thing to do), and the
problem seems to be that there are (Bourne) shells that treat `"$@"'
(_with_ the quotes) as a unit, replacing it with the quoted arguments,
or with nothing at all (not even `""') when there are no arguments.
Others leave an empty argument if there are no arguments (as Manoj
described) by virtue of the quotes around the `$@'. On the latter type,
`${1+"$@"}' does the quoted-expansion thing when there is at least one
bona-fide argument and inserts nothing at all otherwise.

So, in a nutshell [sic!], it depends on the shell. Sometimes `"$@"' on
its own will do the Right Thing, but in general `${1+"$@"}' is the
sensible thing to say from the point of view of defensive programming.

Anselm Lingnau ......................... lingnau@tm.informatik.uni-frankfurt.de
Historically mankind is not very good at drawing fine lines.      --- Ajay Shah

To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: