Why can I do this in zsh:
zsh$ sleep 5 &; echo foo
[1] 14742
foo
but not in bash?
bash$ sleep 5 &; echo foo
bash: syntax error near unexpected token `;'
Is there any way to do the equivalent in bash?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t normally use
zsh, but this seems to be equivalent:It also works in
zsh.I checked zsh documentation and don’t see any special meaning to the combination
&;. This seems to be just a background command followed by an empty command, which gets ignored.bash, on the other hand, doesn’t allow empty commands; you get the same error if you type: