Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: suffix alias
- X-seq: zsh-users 8198
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: suffix alias
- Date: Thu, 11 Nov 2004 14:50:34 +0000
- In-reply-to: <1bvxo3gxze39v$.dlg@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <1bvxo3gxze39v$.dlg@xxxxxxxxxxxxxxxx>
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=(${^path}/$1(N))
(( ${#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.
www.mimesweeper.com
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author