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

Re: Package maintainer script policy.

>>"Anselm" == Anselm Lingnau <lingnau@tm.informatik.uni-frankfurt.de> writes:

 Anselm> Raul Miller wrote:
 >> > 	How many people actually understand what ${1+"$@"} does, really?
 >> Interesting question.  I thought it meant exactly the same thing
 >> as "$@".  Why?

 Anselm> There used to (?) be shells that were so utterly broken that "$@" 
 Anselm> wouldn't work if there was only one argument, so you had to use the 
 Anselm> other idiom instead.

	No, not quite. 

	Actually, the problem is that you need to quote $@ so the
 contents are not evaluated before they are needed. Consider what
 happens if I say 
 % exec some-prog $@
	My shell expands $@. now, if $@ contains some shell meta
 characters, like say `;' or even `\;' we may have problems (in the
 first case, exec is onlyu going to get part of the arguments to pass
 on, and we shall try to eval the rest as another command)

	So, I have to say, at least,
 % exec some-prog "$@"

	Now, suppose some-prog counts its arguments (we don't know, in
 genral, do we?), and does different things when there are no
 arguments (go into interactive mode, for example).

	Well, if $@ is empty, "$@" expands to ""; which is not the
 same as no arguments!! So there is no way to pass the fact that ther
 were no arguments, unless,

 % exec some-prog ${1+"@"}

	How this works is left as an exercise for the user.


 We'd like to make a deal with the computer.  We promise not to fold,
 spindle or mutilate if it will stop asking us to sign our name over
 those little holes in the space marked for signature.
Manoj Srivastava  <srivasta@acm.org> <http://www.datasync.com/%7Esrivasta/>
Key C7261095 fingerprint = CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E

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

Reply to: