From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15912 invoked by alias); 6 Aug 2010 11:33:22 -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: 15254 Received: (qmail 12492 invoked from network); 6 Aug 2010 11:33:20 -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 trustfood.org does not designate permitted sender hosts) Date: Fri, 6 Aug 2010 13:33:14 +0200 From: Eric Smith To: zsh-users@zsh.org Subject: Re: alias -g -> SOLVED Message-ID: Mail-Followup-To: zsh-users@zsh.org References: <20100803191028.GA16019@trustfood.org> <20100803193709.GA1012@altlinux.org> <100804083151.ZM7810@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <100804083151.ZM7810@torch.brasslantern.com> User-Agent: Mutt/1.5.20 (2009-06-14) NICE Thanks Bart - Eric Smith > However, you may be able to get what you want via preexec_functions. > > auto_translate() { > local -a commandline > commandline=( ${(z)1} ) > if [[ $commandline[-1] == T ]] > then > print -R "${commandline[0,-2]}" | translate > fi > } > > # Important that this comes after function definition > alias -g T='${auto_translate?command execution suppressed}' > > # Set auto_translate to the empty string to both translate > # and then execute the original command anyway > unset auto_translate # Force T alias to abort > preexec_functions+=( auto_translate ) >