[gnu.bash.bug] putting multiple cmds in bg using &

pwolfe@kailand.kai.com (Patrick Wolfe) (12/13/89)

I'm not complaining, just making a note of something that surprised me, and
which may affect other people.

I've found something that acts different in Bash than in Csh (the shell I
previously used).  To place a multiple command list in the background, it is
neccessary to use parens to enclose the command.  For example:

	date ; make ; date &

with Bourne Shell or Bash 1.04, runs the first two commands in the foreground
and the last in the background, where C shell will create a background job
which runs all three commands.  To do the same thing with sh or bash (and
probably ksh too), you must enclose the command list within parens:

	( date ; make ; date ) &

Whoever is writing the documentation might want to mention this as a conversion
aid for folks (like me) who are used to the way C shell works.


-- 

        Patrick Wolfe	(pwolfe@kai.com, ...!kailand!pwolfe)
        System Manager, Kuck & Associates

news@bbn.COM (News system owner ID) (12/22/89)

pwolfe@kailand.kai.com (Patrick Wolfe) writes:
< I've found something that acts different in Bash than in Csh (the shell I
< previously used).  To place a multiple command list in the background, it is
< neccessary to use parens to enclose the command.  For example:
< 
< 	date ; make ; date &
< 
< with Bourne Shell or Bash 1.04, runs the first two commands in the foreground
< and the last in the background, where C shell will create a background job
< which runs all three commands.

I'll have to re-read the csh man page, but at a glance I *swear* this
is a csh misfeature (aka. deliberate bug).  The csh man page is vague.
From csh(1):

     Pipelines can be separated by semicolons (;), in which  case
     they are executed sequentially. Pipelines that are separated
     by && or || form conditional sequences in which  the  execu-
     tion  of  pipelines on the right depends upon the success or
     failure, respectively, of the pipeline on the left.

[The way I read the above, "foo && bar" is a (conditional) sequence,
but "foo; bar" may or may not be an unconditional sequence.]

     A pipeline or sequence can be enclosed within parentheses `(
     )'  to  form  a  simple command that can be a component in a
     pipeline or sequence.

     A sequence of pipelines can be executed  asynchronously,  or
     in  the  background by appending an `&'; rather than waiting
     for the sequence to finish  before  issuing  a  prompt,  the
     shell  displays  the job number (see Job Control, below) and
     associated process IDs, and prompts immediately.


Anyway, in every other shell I've ever heard of ; and & are at the
same precedence level.  It's easier to remember, and more intuitive.
Please let's keep bash the way it is, and force people to do

	 (foo; bar) &

like they should have been doing in the first place.

		-- Paul Placeway

trost@reed.bitnet (Bill Trost) (12/27/89)

[Various people writing things about & in csh, including...]
Article <50009@bbn.COM>, by pplacewa@antares.bbn.com (Paul W
	Placeway):

>I'll have to re-read the csh man page, but at a glance I *swear* this
>is a csh misfeature (aka. deliberate bug).  The csh man page is vague.
>From csh(1):
	....

Though I can't find the reference at the moment, it seems as though
something stated that ';' had a higher precedence than '&' in the csh.

Sorry to belabor this in this mailing list --- the csh does it wrong,
in any case.