Possible Sh bug?

Guy Harris guy at auspex.auspex.com
Sat May 20 21:18:10 AEST 1989


>The status 1 after the "if" command is the one returned by the last command
>executed, in this case "test".  ("[" is a link to test - see the man page for
>test(1)).

The first isn't true in SunOS 3.0 and later; to quote from another
article:

	Although this may not be strictly relevant to these particular
	machines, according to the SysV manual entry for sh(1),

	"If no *else* list or *then*" list is executed, then the *if* command
	returns a zero exit status."

which *is* relevant to the Sun, since the Bourne shell in SunOS has been
derived from the System V version since SunOS 3.0 (R2 in 3.x, R3.1 in
4.x).

The second is true in SunOS, but irrelevant - the S5 Bourne shell has
"[" as a builtin, with "test" a synonym for it.



More information about the Comp.unix.questions mailing list