sh bug

Mark Brader ntt at dciem.UUCP
Fri Sep 30 03:22:47 AEST 1983


I don't think the shell should accept the example

	while (something)
	do
		command <<EOF &
	This is a $test.
	EOF
	done

given by rlgvax!guy (Guy Harris).  I think & should cut off what the
forked shell sees, so that the above example would be typed as:

	while (something)
	do
		( command <<EOF
	This is a $test.
	EOF
		) &
	done

Never having used a shell where <<...& worked anyway, I don't know whether
the first version is supposed to work.  However, an approximation of the
desired effect can be obtained by now replacing the (...) with sh -c "...".
It's not as good because of having to escape quotation marks and because of
the limit on argument lists, but will work for simple cases.

I also think the precedence of & and ; should not be equal; I think
a;b&c;d& should be interpreted as (a;b)&(c;d)& with the present interpretation
having to be typed as a;(b&);c;(d&), similarly to ; and |.

Mark Brader, NTT Systems Inc., Toronto



More information about the Comp.unix.wizards mailing list