You are not logged in.
What I'm trying to do is this:
for i in $(seq 3); do
sleep $i &
done
but bash doesn't like the one-line version:
[foutrelis@foutboxd ~]$ for i in $(seq 3); do sleep $i &; done
-bash: syntax error near unexpected token `;'
Halp?
Last edited by foutrelis (2008-09-20 17:23:23)
Offline
This does work in zsh:
for i in $(seq 3); do sleep $i &; done
It exits with the same error message as you got in bash though..
Offline
The '&' after the sleep command is the termination of the command, so you don't need the extra ';'
$ for i in $(seq 3); do sleep $i & done
See the section "Lists" under "SHELL GRAMMAR" near the top of the bash man page.
Last edited by jcasper (2008-09-20 17:19:13)
Offline
@jcasper: Awesome. Thanks a bunch!
Offline