Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Docs fix
- X-seq: zsh-workers 4459
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hacking and development)
- Subject: Re: Docs fix
- Date: Mon, 26 Oct 1998 23:13:47 -0600 (CST)
- In-reply-to: <981026202123.ZM12435@xxxxxxxxxxxxxxxxxxxxxxx> from Bart Schaefer at "Oct 26, 98 08:21:23 pm"
Wow, I did not expect to stir such a debate.
> The context here is the question about converting csh aliases to zsh.
Sure, and you are absolutely right in that \!* corresponds to $*. And
there are certainly legitime cases where you would realy want to use $*.
But the examples in the FAQ are not such cases:
cd() { builtin cd $*; echo $PWD; }
rm() { command rm -i $* }
l() { /bin/ls -la $* | more }
In all these cases you really want to use "$@". Especially in case of
cd, I often use the two argument cd with empty second argument. There is
a good example in the FAQ where $* is the right thing:
xhead () { print -n "\033]2;$*\a"; }
And one more point, people misuse csh's \!* as often as they do misuse
$*.
> alias do "\!* >&! did &"
> alias dopr '\!* | lpr -J "\!:1"'
>
> If you replace $* with "$@" when converting those aliases, you end up
> quoting the word in the command position, which causes unexptected side
> effects.
This really does not have any relevance to this discussion, but what are
those side effects? Alias expansion and reserved word recognition is not
done on the result of either $* or "$@" expansion. The exact conversion
of these csh aliases would be rather tricky.
Zoli
Messages sorted by:
Reverse Date,
Date,
Thread,
Author