Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Docs fix

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.


Messages sorted by: Reverse Date, Date, Thread, Author