A new shell. Any takers?

Hamish Macdonald himacdon at maytag.uwaterloo.ca
Wed Jan 16 08:35:33 AEST 1991


>>>>> In article <andy.663963786 at xwkg>, andy at xwkg.Icom.Com (Andrew H.
>>>>> Marrinson) writes:

Andrew> I almost sent email asking this same question.  Then I
Andrew> realized why.  (At least, I think I realized.)  The if not
Andrew> command is not exactly the same as an else.  True, in the
Andrew> above example it seems it could be replaced with else to good
Andrew> effect, but consider:

Andrew> 	if (command) {
Andrew> 		if (command)
Andrew> 			command
Andrew> 	}
Andrew> 	if not
Andrew> 		command

Andrew> I suspect the if not applies to the second if, not the first.
Andrew> Naming it else would cause people to expect it to apply to the
Andrew> first if, as an else would.  Calling it if not makes it clear
Andrew> it is different from else: it applies to the last if command
Andrew> run, and knows nothing about the lexical structure of the
Andrew> script.

Nope.  The "if not" applies to the first if (by experimentation).
"rc" must stack the results of the "if"s.  I suspect it uses "if not"
because the:
	if not
		command
is a separate statement.

Hamish.
--
--------------------------------------------------------------------
himacdon at maytag.uwaterloo.ca                 watmath!maytag!himacdon



More information about the Comp.unix.shell mailing list