From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19785 invoked by alias); 8 Jun 2010 15:34:27 -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: 15107 Received: (qmail 910 invoked from network); 8 Jun 2010 15:34:26 -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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.214.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=i1FSDQIXukF8MR8zOKh6FydIYgT7T4cuVSd6nZ3iobQ=; b=SKM/QNwVPAPDPelW3dOv9UGawCfNjXbTF/7zJqlcEFsOdfXwBW0YM8B6OyZx+GOnSx 8c0wUBaZAPXGRgLIc04vJup/jdVIXiKFlGt6M3HwKciOx6MgPAGKgJUDsRWUngM/iaD7 Ilg/qds0Cf/TW727+BXBnX5/Gpcx58F3LjJ7g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=gxxRYTaO41J2xtjDZy0ynpbxVSa0S6uRVb2Nlyb+1wsn6UqpiRooo9rWMR8y+3WTFc p5J7lkN/twu9/YQG+yCi/WoPNvkhIVYHClrF24XRKkP612T4pF+DDd64cx/DRG8XrubH GurCMaLlCiu59WzJ+Jt+8oAx6s+UPpi2WPbDo= MIME-Version: 1.0 In-Reply-To: <4C0E612E.8060604@googlemail.com> References: <4C0E612E.8060604@googlemail.com> Date: Tue, 8 Jun 2010 17:34:21 +0200 Message-ID: Subject: Re: Is there a kind of function factory in zsh? From: Mikael Magnusson To: Leander Jedamus Cc: zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 On 8 June 2010 17:26, Leander Jedamus wrote: > Hi! > > I wonder if I could use a pattern for creating fucntions, that nearly look > the same. > Background is I have to write a function for ssh, telnet, su, bash, zsh, > tcsh and so on that all look like (for example for the ssh command): > ssh() > { > set_title "ssh $@" > { > command ssh "$@" > } always { > cd . > } > };# ssh() > How can I avoid writing all that code again and again? > > Thanks in advance > Leander Jedamus > ssh bash bing foo bar baz() { echo $0 } -- Mikael Magnusson