Subject: Re: bashism for ksh
To: None <>
From: Thorsten Glaser <>
List: tech-userlevel
Date: 09/27/2007 12:53:37
Peter Bex dixit:

>Afaik the subshell returns the exit status of the last command it
>runs.  Thus you can just reap the exit status of the subshell with

True. He or you might be creating a patch.

>In zsh, I have this neat expression as part of my PROMPT variable:
>It's unreadable, but it means:
>"print in bold the following:


>if the previous command's exit status was 0, display nothing (empty
>string between the first and second dot), if it was nonzero, display
>the exit status between brackets."

=E2=80=A6$(((e=3D$?))&&print "($e)")^A^[[0m^A'

The stock dot.mkshrc example contains something like that (and if you
check out mksh-current via anoncvs, you even get pushd/popd/dirs csh-
like (even implemented to behave exactly like (open)bsd csh, and the
zsh-like precmd() and chpwd() hooks=E2=80=A6 users requested it=E2=80=A6).

I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy the=
If you don't believe in God, just consider God as Nature if you won't deny
existence.=09=09-- Coywolf Qi Hunt