Subject: Re: CVS commit: basesrc/bin/ksh
To: Joerg Klemenz <joerg@gmx.net>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-userlevel
Date: 09/28/2002 07:58:52
On Sat, 28 Sep 2002, Joerg Klemenz wrote:

> Simon J. Gerraty wrote:
> > >Also the lack of a .kshrc file or whatever forces you to put ksh
> > >specific stuff in .profile or $ENV and ifdef it out which doesnt
> > >always work.
> >
> > Its unfortunate that both sh and ksh use $ENV. Put
> >
> > if [ x$RANDOM != x$RANDOM ]; then
> > fi
>
> Like I just told Mr. Woods, this one fails w/ both BASH and zsh and
> any other sh-compatible system that has a working $RANDOM.
>
> Thats exactly what I'm talking about. There is simply no reliable way
> to detect what sh one is running.
> Thats why every other shell except ksh uses its own *rc file for
> non-interactive use.

This works well enough:

  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.

Frederick