From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16454 invoked by alias); 8 Jun 2010 15:42:41 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15108 Received: (qmail 14903 invoked from network); 8 Jun 2010 15:42:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at chaosdorf.de does not designate permitted sender hosts) Date: Tue, 8 Jun 2010 17:37:15 +0200 From: Daniel Friesel To: zsh-users@zsh.org Cc: Leander Jedamus Subject: Re: Is there a kind of function factory in zsh? Message-ID: <20100608153715.GA7151@derf.homelinux.org> References: <4C0E612E.8060604@googlemail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="liOOAslEiF7prFVr" Content-Disposition: inline In-Reply-To: <4C0E612E.8060604@googlemail.com> User-Agent: Mutt/1.5.20 (2009-06-14) --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --liOOAslEiF7prFVr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkwOY6sACgkQjuWtMO0ss3/EkgCffx8KbgT3r9QK3GEp8QemQJwe kDAAnjgz4+757RVP2JdX6luwLMOmkvQi =mmvC -----END PGP SIGNATURE----- --liOOAslEiF7prFVr--