Subject: Re: [resend] please test and commit: upgrade for pkgsrc/shells/mksh
To: None <pkgsrc-users@netbsd.org>
From: Thorsten Glaser <tg@mirbsd.de>
List: pkgsrc-users
Date: 03/20/2007 17:05:00
Aleksey Cheusov dixit:

>Have you a plan to implement in mksh an analog to bash's ${PIPESTATUS[@]},
>or zsh's $pipestatus?

I don't know GNU bash or zsh that well=E2=80=A6

>                      IMHO it very useful feature for interactive use.
>
>example of my prompt:
>
>0 ~>true
>0 ~>false
>1 ~>true | true | false
>0 0 1 ~>false | true | false
>1 0 1 ~>

=E2=80=A6 but judging from this, it's not possible to do that because the l=
ast
command of a pipeline is run in a subshell. I also do not intend to
add =E2=80=9Corthogonal=E2=80=9D extensions like this one, because mksh, ev=
en if it's
designed to not put stones in your way if you use it interactively,
is primarily a scripting shell. Let me illustrate this with a small
example. Someone wanted a zsh-like precmd() hook, which I told him
to implement it like this:

| export PS1=3D'$(precmd)'"$PS1"

Same for zsh-like chpwd():

| function cd
| {
|=09chpwd "$@"
|=09builtin cd "$@"
| }

I want the =E2=80=9Ccore=E2=80=9D of the shell small but functional, and ad=
ding these
directly in the core isn't going along well with the KISS, BSD, whatever
principles I have.

But you might have noticed I have $? in my prompt as well ;)

bye,
//mirabile
--=20
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=
m.
If you don't believe in God, just consider God as Nature if you won't deny
existence.=09=09-- Coywolf Qi Hunt