Bourne shell modifications, past and future

Arnold Robbins arnold at gatech.CSNET
Wed Nov 27 04:12:50 AEST 1985


In article <847 at whuxl.UUCP> mike at whuxl.UUCP (BALDWIN) writes:
>I think providing *both* aliasing and functions is a misfeature!  Why have
>two inconsistent ways of doing the same thing???

I agree, which is one of the reasons I'm not putting aliasing in.

>"Real" exported functions ala V8 are very nice.  However, something like
>$ENV can still be useful for things like setting certain options for
>all invoked shell (e.g., set -au) or having the prompt show the level
>(PS1=">$PS1").  The only way to do these things is with $ENV.

My first go 'round used $HOME/.shrc, ala the csh. This time I am implementing
$ENV, like the ksh. Also checking for ./.profile and them $HOME/.profile,
like the ksh. Exported functions would be real nice, but I don't think I'm going
to have time to try and figure that one out.

>Back to my first point:  please don't implement something 2 or 3 times
>in different ways!

Agreed! Everything that I will add that is ksh compatible will have the same
syntax and semantics (or as near as I can make it, without a ksh to check
against).  If I add something to the shell that is similar but not exactly the
same as the ksh, it will have a DIFFERENT syntax, so that you know you're doing
something non-standard. (I do have a ksh man page, obtained from AT&T, with
the help of David Korn and the folks at the toolchest. Don't go flooding them
with requests for it, though.)

> ....Functions subsume aliases very nicely, so chuck
>aliases!  Don't have funny % sequences in prompt strings when `uname`
>or `pwd` will work fine.

The problem is that PS1="`pwd` " will only evaluate pwd once, and one would
want whatever the directory is now. Same with PS1="$PWD ". Which is why I
use funny % sequences. At least no one else uses them.

>              I.e., if pwd is slow, build pwd into the shell instead
>of adding a $PWD or $cwd variable.

Once pwd is built in, $PWD is almost trivial (having just done it...)

>However, instead of building in fd2
>(remember fd2?), extend redirection to include file descriptors.

I do indeed remember fd2, on a pdp-11/70 running INTERactive Systems IS/1
(A V6, sort of, look alike. Really bad)

>						Michael Baldwin

Anyway, I'm not really arguing, but since the ksh isn't public domain, I will
do my best to be as compatible with it as I can, and when I add features,
they will have a different syntax than the ksh. My goal is not replace or denigrate
what David Korn has done; but to fill a gap out there for those who can't get
the ksh, and who, on BSD systems, don't like the csh.

-- 
Arnold Robbins
CSNET:	arnold at gatech	ARPA:	arnold%gatech.csnet at csnet-relay.arpa
UUCP:	{ akgua, allegra, hplabs, ihnp4, seismo, ut-sally }!gatech!arnold

Real Unix hackers disdain wimpy languages like C and AWK in favor of /bin/sh.



More information about the Comp.unix.wizards mailing list