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

Re: suffix alias

Thorsten Kampe wrote:
> Hi,
> I have a suffix alias "alias -s py=python". Now I can execute Python 
> scripts by name that don't have a "she-bang" and aren't executable. 
> That's great.
> But now I noticed that I cannot execute Python scripts anymore that 
> are placed in my path (/usr/bin for example) because zsh doesn't 
> search the path anymore for the suffix alias.
> Is there a solution for this problem?

exec-py () {
        local -a files
        (( ${#files} )) && set -- $files[1] "${(@)argv[2,-1]}"
        python "$@"
alias -s py=exec-py

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.


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