uname output: Linux hairy 2.6.12-10-686 #1 Fri Apr 28 13:21:56 UTC 2006 i686
GNU/Linux
Machine Type: i486-pc-linux-gnu
Bash Version: 3.0
Patch Level: 16
Release Status: release
Description:
The following bash loop works:
for i in 30 31 32
do sleep $i &
done
but this gives a syntax error:
for i in 31 31 32 ; do sleep $i & ; done
As a work-around you can do:
for i in 31 31 32; do sleep $i & true ; done
or
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)
but this reveals another bug which is that the 'jobs' command shows the
unsubstituted commands and thus you cannot distinguish the jobs, vis:
[1] Running sleep $i &
[2]- Running sleep $i &
[3]+ Running sleep $i &
According to the bash man page a 'control operator' is one of the following
symbols:
|| & && ; ;; ( ) | <newline>
which play the same syntactic role in defining comands, so the sequence
& ;
should be as valid as the sequence
& <newline>
Toby