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

=alias



There have been rumblings of discontent that equals substitution (=cmd),
if it can't find an external command for which to insert the full path,
instead expands aliases.  For example,

% alias ls='ls -F' notacommand='echo Hello'
% print -l =ls =notacommand
/home/pws/bin/ls
echo Hello

The problems are

- You can't be sure what you're going to get.  If you don't guard
  specially against aliases (in which case the expansion is not the
  shortcut it's supposed to be) you can get errors.
- Aliases look completely different; they may not be single words
  and almost certainly aren't files.  So it's difficult to handle both
  possible results in the same place.
- The lookup is not only different from normal command execution, it's not
  even in the same order.  If you have both an alias and a command, you
  get the command, whereas the shell would run the alias if given
  the same string.
- Hence you can't guarantee to be able to expand a given alias that way
  at all.  The zsh/parameter module provides specific alias lookup.

The alias-lookup feature apparently appeared around 2.5.

Is there anybody out there who wouldn't shout for joy if we removed the
alias-lookup part of =-substitution so that it only expanded command paths?

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, 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