Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Is there a kind of function factory in zsh?
- X-seq: zsh-users 15108
- From: Daniel Friesel <derf@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Is there a kind of function factory in zsh?
- Date: Tue, 8 Jun 2010 17:37:15 +0200
- Cc: Leander Jedamus <ljedamus@xxxxxxxxxxxxxx>
- In-reply-to: <4C0E612E.8060604@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <4C0E612E.8060604@xxxxxxxxxxxxxx>
You could build a function factory with eval, but in this case there is an
even easier possibility:
function ssh telnet su bash zsh tcsh {
set_title "$0 $@"
{
command $0 "$@"
} always {
cd .
}
}
This defines a function for ssh, telnet etc., $0 always evaluates to the name
by which the function was called.
--derf
Attachment:
signature.asc
Description: Digital signature
Messages sorted by:
Reverse Date,
Date,
Thread,
Author