pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [resend] please test and commit: upgrade for pkgsrc/shells/mksh



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…

>                      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 ~>

… but judging from this, it's not possible to do that because the last
command of a pipeline is run in a subshell. I also do not intend to
add “orthogonal” extensions like this one, because mksh, even 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='$(precmd)'"$PS1"

Same for zsh-like chpwd():

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

I want the “core” of the shell small but functional, and adding 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
-- 
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 them.
If you don't believe in God, just consider God as Nature if you won't deny
existence.              -- Coywolf Qi Hunt



Home | Main Index | Thread Index | Old Index