Subject: Re: CVS commit: basesrc/bin/ksh
To: Joerg Klemenz <joerg@gmx.net>
From: Greg A. Woods <woods@weird.com>
List: tech-userlevel
Date: 09/28/2002 15:09:01
[ On Saturday, September 28, 2002 at 14:33:17 (+0000), Joerg Klemenz wrote: ]
> Subject: Re: CVS commit: basesrc/bin/ksh
>
> 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.

Actually it doesn't "fail" with both bash and zsh.

The original problem was how to put "ksh" (implying NetBSD /bin/ksh)
specific code in a separate file, no doubt so that the same ~/.* files
can be used with both /bin/sh and /bin/ksh.  The above test is more than
sufficient to achieve that limited goal.  Obviously if you throw bash
and/or zsh into the equation then things get more complicated, but not
impossibly so.

> Thats exactly what I'm talking about. There is simply no reliable way
> to detect what sh one is running.

Yes, there is.  Please look at my complete ~/.profile.  It is 100%
portable across all the platforms I use regularly and no doubt still
portable to many of the older systems I no longer use.  I have no doubt
the mechanisms I use can easily be extended to handle zsh if necessary,
and I have been thinking of cleaning it up somewhat so that I can treat
all the POSIX compatible shells in the same manner and thus hopefully
ease some of the maintenance overhead.

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>