tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: What should we do with the -n flag in sh ?



On Mon, Feb 22, 2016 at 09:14:17PM +0700, Robert Elz wrote:
 > I suspect the right fix for this one is to do as POSIX permits, and
 > ignore -n in interactive shells.   But I am not sure which method
 > to use to do that ... it could be done by any of ...
 > [...]

What you wrote gave me an idea, that unfortunately probably isn't very
easy to do: in an interactive shell, clear -n right before or as part
of printing the prompt. That lets one do things with it (to some
extent) and source scripts that use set -n, but avoids getting
trapped.

 > My opinion on this is that once -n is set, all command execution stops,
 > including while (until, for, ...) loops that were in progress, and all
 > that is left of the shell is a syntax parser.

Concur.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index