pdksh vs. mksh info [was: Re: Apparently, csh programming is considered harmful.]

Jurjen Middendorp jurjenm at stack.nl
Thu Dec 20 05:05:51 PST 2007

On Mon, Dec 17, 2007 at 03:32:38PM -0500, Chuck Robey wrote:
>Jurjen Middendorp wrote:
>>>>  If you're familiar with pdksh, are you also familiar with ksh93, which
>>>>is (I believe) Mr. Korn's own shell?  If you are, I would be interessted
>>>>  in your opinion of the two, any comparisons you might give.
>>>I've never used ksh93 so I really can't say.  There is a NOTES file
>>>included with pdksh which gives a starter.  I created this port a few
>>>years ago because of some random issue I've long since forgotten with
>>>pdksh on my FreeBSD box which didn't happen on my OpenBSD box.
>>I never used pdksh, but am using ksh93 for quite a while now and have used
>>bash, too. For some reason i like it better than bash, the vi mode is a bit
>>better somehow, it feels alot sturdier. It doesn't have those special
>>variables like $! and !! i believe, but it has alot of neat features like

-----------------^ i ment !$ offcourse :)

>>basic network programming, lots of parameter expansion stuff and is just a
>>very nice shell :)
>I havre installed it, and played with it a bit, I admit it's nicer than 
>sh (and I *think*, bash) but the reason I haven't tried using it 
>regularly is because I can't find a nicely set up .kshrc ... if you have 
>one, I'd appreciate a copy.  Might be nice, if it's not terribly long, 
>to post it to the list, too.

Basically it's just like any other shell .*rc. It sets some environment
variables for stuff, a bunch of aliases and some functions i find useful
myself, or am too lazy to throw away. Nothing really ksh-specific, except
maybe some of the functions i wrote use ksh-stuff like arrays, but that's
not really ksh-specific as well.  You could use google to find any .*rc for
sh-like shells and copy those (or get a copy of unix power tools, it's a
nice book to make you feel at home in a shell)


ps. these functions i probably use the most :)

alias d="do_in_bg dillo"
alias x="do_in_bg xpdf"
alias ff="do_in_bg firefox"
#do a program in the background:
do_in_bg() {
    "$@" > /dev/null 2>&1 &

#open a webpage from disk, like: $cd /usr/share/doc/en && htm 
#to look at all the (english) freebsd-docs :)
htm() {
    set -A stuff $(find -L . -name "index.htm*" -print)
    (for ((i=0; i < ${#stuff[*]}; i++)); do print "$i \t: ${stuff[i]}"; done) | $PAGER
    read x && d ${stuff[$x]}

More information about the freebsd-questions mailing list