What's set -n for ?

Martin Weitzel martin at mwtech.UUCP
Tue Oct 23 04:32:01 AEST 1990


In article <1295 at tardis.Tymnet.COM> jms at tardis.Tymnet.COM (Joe Smith) writes:
>Q: What is "-n" good for in /bin/sh?
>A: "sh -nv shell_script_being_debugged".

True answer, but there's an interesting bug, at least in some flavours
of UNIX SysV: A script containing

	....
	while read a
	do
		... something ....
	done
	....

hangs, even if you "debug" it with the -n option of the shell set. Note
further, that if you substitute an `if' for the `while' in the above
example, everything is fine.

Though I can understand that bugs like this may slip into a program
(execution of the internal command `read' is not properly inhibited)
I allways wondered about the differences depending on the if/while
context. Is there anybody out there with more insight (esp. someone 
with access to the shell sources?)
-- 
Martin Weitzel, email: martin at mwtech.UUCP, voice: 49-(0)6151-6 56 83



More information about the Comp.unix.shell mailing list