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

Re: Rationalized? aliases



> Now however, the rationalized alias output makes this not work:
> 
> % echo $ZSH_VERSION
> 2.6-beta11
> alias e="gnuclient -q"
> % [[ $HOST != $HOMESYSTEM ]] && alias e="$(whence e) -h $HOMESYSTEM"
> % type e
> e is an alias for \''gnuclient -q'\'' -h spacely'
> 
> This is not what I desire ('gnuclient -q' is not a valid command) - what
>  I want is to append "-h spacely" to the alias.  How can I do this?

Hmm... A quick fix for your problem is to change
printaliasnode() in hashtable.c so that when the flags
PRINT_WHENCE_* are present, that it will use printf (or puts)
instead of printquoted().  This is exactly how it was done in
beta10.  But is this what we want to do?  It looks natural for
the output of `type' and `which' to be quoted.  For `whence' it
is not quite so clear which is best.

Rather than changing the code of zsh for this, maybe you should
just use

alias e="$(whence e | tr -d \') -h"

Doing things like this is what makes command substitution so
cool.

rc






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