Bourne-shell incompatibilities

John Chambers jc at minya.UUCP
Sun Jan 6 01:35:27 AEST 1991


> >The problem is that I can't figure out any Bourne-shell expression that
> >gives the last argument.  In C-shell, it's easy (argv[$#]).  But I need
> >to write Bourne shell scripts.  In fact, they need to be BSD bourne shell
> >scripts rather that ATT Bourne shell scripts.  The difference is probably
> >significant here, because of the differences in the way these two Bourne
> 
>   As an aside, could you explain this comment?  I have had minimal contact
>   with BSD, but my experience does not seem to support this statement.

Well, one difference that has bitten me is
	${x-foo}
versus:
	${x:-foo}

Often only one of these is accepted by any particular /bin/sh, and the
other is a syntax error.  Sometimes both are accepted (with different
meanings).  BSD /bin/sh usually only understands the first format, and
the script dies if you use the second format.

(Isn't it wonderful to have such a nice tool for portable scripts? ;-)
-- 
Zippy-Says: Imagine ... a world without clothing folds, chiaroscuro, or marital difficulties ...
Home: 1-617-484-6393 Work: 1-508-952-3274
Uucp: ...!{harvard.edu,ima.com,eddie.mit.edu,ora.com}!minya!jc (John Chambers)
Uucp-map: minya	adelie(DEAD)



More information about the Comp.unix.shell mailing list