From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16025 invoked from network); 9 Dec 1998 01:21:03 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 9 Dec 1998 01:21:03 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id UAA07214; Tue, 8 Dec 1998 20:14:44 -0500 (EST) Resent-Date: Tue, 8 Dec 1998 20:14:37 -0500 (EST) Message-ID: <19981209011923.40055@athenaeum.demon.co.uk> Date: Wed, 9 Dec 1998 01:19:23 +0000 From: Phil Pennock To: zsh-users@math.gatech.edu Subject: Re: "Fallback" alias/function in zsh Mail-Followup-To: zsh-users@math.gatech.edu References: <19981208220443.A180@morpheus.demon.co.uk> <981208155032.ZM7173@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <981208155032.ZM7173@candle.brasslantern.com>; from "Bart Schaefer" on Tue 8 Dec 1998 (15:50 -0800) Organisation: Organisation? Here? No, over there ----> X-Disclaimer: Any views expressed in this message, where not explicitly attributed otherwise, are mine and mine alone. Such views do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. X-Phase-of-Moon: The Moon is Waning Gibbous (67% of Full) Resent-Message-ID: <"M5Rvy.0.Em1.zxSRs"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1967 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Typing away merrily, Bart Schaefer produced the immortal words: > In 3.1.5, there's the preexec() function, in which you could do something > like this: > > function preexec() { > command=("$@") > } > function precmd() { > (($?)) && CMD /C "$command[@]" > } [...] > This will do unusual things when you execute compound commands (separated > with ; && || etc.) and won't work for backgrounded commands (&) but should > do what you want for simple commands typed at the prompt. That seems dangerous. The problem looks to be 'if path lookup fails' not 'if path lookup fails or program returns non-zero'; could be fun to run a grep(1) port and have it run twice if no matches were found ... -- --> Phil Pennock ; GAT d- s+:+ a22 C++(++++) UL++++/I+++/S+++/H+ P++@ L+++ E-@ W(+) N>++ o !K w--- O>+ M V !PS PE Y+ PGP+ t-- 5++ X+ R !tv b++>+++ DI+ D+ G+ e+ h* r y?