bug-bash
[Top][All Lists]
Advanced

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

Re: Syntax error with background jobs in loops


From: Eric Blake
Subject: Re: Syntax error with background jobs in loops
Date: Thu, 08 Jun 2006 07:11:28 -0600
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Toby Kelsey on 6/8/2006 4:34 AM:
>   for i in 31 31 32; do sleep $i & done
> 
> (note the last one should give a syntax error since it violates the
> for-loop
> syntax "for name [ in word ] ; do list ; done", but instead it works)

Actually, according to the POSIX grammar,
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_10_02,
the syntax for <for_clause> includes a <do_group>, which is 'do'
<compound_list> 'done'; and the syntax of a compound list can end in a
<separator_op> which is either '&' or ';'.  Using BOTH '&' and ';' is the
true syntax error, and the above example is not a workaround, but the
correct syntax.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEiCIA84KuGfSFAYARApwgAJ9UkLS0+MT7gZ5PiEXdeWWrEDvRKwCgmw5d
dK8Is4pQTrOpT9WU7ub+y8w=
=9QiW
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]