I ran this on my Centos5 box:
ls -al & ; ls -al
I was expecting it to run ls -al in the background, and concurrently run ls -al in the foreground, and demonstrate how the output to terminal gets all mangled by doing so.
However, I get:
-bash: syntax error near unexpected token `;’
How can I write these two commands on the same line?
Unintuitively,
&is a command separator as well as a forker. That means you actually have three commands:… and Bash does not support the empty statement.
Instead, simply write:
with no semicolon.