Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Zsh 3 and ${1+"$@"} (Was: [GNU Autoconf 2.53] testsuite.log: 126 failures)
- X-seq: zsh-workers 16951
- From: Peter Stephenson <pws@xxxxxxx>
- To: Akim Demaille <akim@xxxxxxxx>, zsh-workers@xxxxxxxxxx, ab@xxxxxxxxxx, bug-autoconf@xxxxxxx
- Subject: Re: Zsh 3 and ${1+"$@"} (Was: [GNU Autoconf 2.53] testsuite.log: 126 failures)
- Date: Tue, 09 Apr 2002 12:59:48 +0100
- In-reply-to: "Oliver Kiddle"'s message of "Tue, 09 Apr 2002 12:45:26 BST." <20020409114526.GA30136@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Oliver Kiddle wrote:
> One idea would be if you can use a global alias, e.g.:
> [ x$ZSH_VERSION != x ] && alias -g '${1:"$@"}'='$=@'
>
> Is the ${1+"$@"} always used as a word on its own? The rhs of the alias
> may have to be something different - I didn't entirely understand the
> problem but you'd have the full flexibility of zsh 3.0.8 expansions so
> I'd be suprised if it couldn't be made to work.
Crikey, it works! I put '"$@"' on the right of the alias and it does
the trick. This is 3.0.8.
% setopt shwordsplit
% [ x$ZSH_VERSION != x ] && alias -g '${1+"$@"}'='"$@"'
% set 'one word' 'two words'
% for arg in ${1+"$@"}; do echo $arg; done
one word
two words
As Oliver says, you have to make sure you use *exactly* the form
${1+"$@"} and no other set of characters. But you have control over
that, so putting
[ x$ZSH_VERSION != x ] && alias -g '${1+"$@"}'='"$@"'
at the top of the script may be just what you want. (As I said before,
"$@" will work the way you want it.)
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author