Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: "Fallback" alias/function in zsh
- X-seq: zsh-users 1967
- From: Phil Pennock <phil@xxxxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: "Fallback" alias/function in zsh
- Date: Wed, 9 Dec 1998 01:19:23 +0000
- In-reply-to: <981208155032.ZM7173@xxxxxxxxxxxxxxxxxxxxxxx>; from "Bart Schaefer" on Tue 8 Dec 1998 (15:50 -0800)
- Mail-followup-to: zsh-users@xxxxxxxxxxxxxxx
- Organisation: Organisation? Here? No, over there ---->
- References: <19981208220443.A180@xxxxxxxxxxxxxxxxxxxx> <981208155032.ZM7173@xxxxxxxxxxxxxxxxxxxxxxx>
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?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author