Subject: Re: CVS commit: basesrc/bin/ksh
To: NetBSD Userlevel Technical Discussion List <tech-userlevel@netbsd.org>
From: Matthias Buelow <mkb@informatik.uni-wuerzburg.de>
List: tech-userlevel
Date: 10/03/2002 05:42:05
Greg A. Woods writes:

> > Matthias Buelow wrote:
> > > That's why you don't export ENV.
> > 
> > That makes no sense. ENV is completly useless if it's not exported. If
> > you keep ENV local, subshells will have no aliases or keybindings. A
> > non-exported ENV has no other effect than ". shrc" in .profile.
> 
> Well, if you use sub-shells....   :-)

Well, I have to add that as a matter of fact my .profile does export
ENV, I must've been a bit confused about matters when I wrote the
above, Joerg is right in that regard that it wouldn't make much
sense...

> Personally I've always thought that job control and sub-shells are more
> or less archaic features when you have a window system (and _everyone_
> has a window system, or at least a simulation of one: window(1) :-).

I use job control frequently, ^Z is typed much faster than starting
a new xterm.

> However iff you use the trick Korn suggested, and which I showed, then
> you can safely export $ENV and then any interactive subshell you start
> will indeed benefit from your personal customizations, while
> non-interactive shells won't lead you into relying on features other
> people's non-interactive shells don't have.

Given the rich command language of the Kornshell, there's little one
cannot do; and many things are not immediately obvious from a quick
read through the (ksh93) manpage, it's amazing what you discover when
you read Bolsky/Korn's book (I think I remember you also have it,
Greg), although, basically it's all hidden somewhere in the manpage,
or at least hinted at.  Joerg: I don't really think that adding a new
set of (incompatible) startup files just as some cosmetic makeup makes
sense... the same can be achieved with rather little programming in
the shell's own command language.  It's like with the PS1 shell
prompt; in bash you have an explicit set of escape sequences with are
replaced with certain system values, like the working directory
relative to the homedir (\w), host name (\h) and so on.  It may be
convenient for beginners but then again, I've never seen beginners
worry about their shell prompt, they usually take what the system
predefines.  However, the same sophistication wrt the prompt, if not
more, can be done in ksh aswell.  It's just that it involves a little
programming and there're not predefined escape sequences.  In bash, an
explicit feature is provided where in ksh the user is expected to use
the more general command language to achieve the same result.  IMHO
the latter is a preferrable means of doing things, not just in shells.

-- 
Matthias Buelow, mkb(at)informatik.uni-wuerzburg.de