sh changes

Guy Harris guy at sun.uucp
Thu Jun 19 06:23:35 AEST 1986


> I hit an incompatability between the 4.2 BSD sh and Sun 3.0 sh.

No, you didn't.  Keep reading.

> Here are the relevant parts of the manual pages:
> 
> From 4.2 BSD system:
> 
>      ${parameter-word}
>           If parameter is set, substitute its value; otherwise
>           substitute word.
> ...
> 
> From Sun 3.0 system:
> 
>      ${parameter:-word}
>           If parameter is set and  is  non-null,  substitute  its
>           value; otherwise substitute word.

> In case you missed it, the difference is the extra colon in the Sun 3.0
> system.

And the phrase "and is non-null", which appears in the description in the
Sun 3.0 manual.  Like I said, keep reading.  In the 3.0 manual, below that,
it says:

	If the colon (:) is omitted from the above expressions,
	the shell only checks whether "parameter" is set.

So it's a compatible enhancement; you can leave the colon out, and if you do
it acts like earlier shells.

> Questions: when and why was this change made?

It was made in Sun UNIX 3.0, and was made because the System V Release 2
shell, which is the Sun UNIX 3.0 shell, is better than the 4.2BSD shell
(faster, more functional, less buggy, you name it).

> Are there any other variants of Unix with this change?

Any variant using a System III or later shell.

> Has anybody's command file broken on account of this?

Since it's a compatible enhancement, I tend to doubt it.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.com (or guy at sun.arpa)



More information about the Comp.unix mailing list