Subject: Re: CVS commit: basesrc/bin/ksh
To: None <tech-userlevel@netbsd.org>
From: Joerg Klemenz <joerg@gmx.net>
List: tech-userlevel
Date: 09/29/2002 17:40:33
Frederick Bruckman wrote:
> 
>   case $- in *i*)
> 
>   if [ $0 = ksh -o $0 = -ksh -o $0 = /bin/ksh ]; then
> 
>   fi
> 
>   fi
> 
> Sure, you could start an interactive shell with "cd /bin; ./ksh" or
> similar, but it doesn't come up in practice.

This code fails too if the user has compiled his own binary and runs
it from ~/bin/ksh.

Since we are exchanging tips now I'll give you mine to. I put this in
/etc/profile to load /etc/kshrc and $HOME/.kshrc if exists

if (echo $0|grep -q ksh)
then
    ... ksh stuff
fi

Still can't tell the difference between pdksh and ksh.

All of this hacks are only needed because of ksh's lack of a "real" rc
file.

To make things even worse, there's no way that I know of to load
defaults for non-interactive non-logged-in shells. The retarded $ENV
construct assumes that the user is logged in when he starts a
non-interactive shell.

But many a script is run from cron or at and there is no way to force
the loading of any defaults or even a PATH.

All of that can be fixed, though. ksh is basically OK
I guess I have to write that maintainer now...

-- 
joerg klemenz <joerg@gmx.net>