0

When I try something like

$command &; command2

, bash returns me

bash: syntax error near unexpected token `;'

How can I do that?

aaa
  • 157
  • 1
  • 11

1 Answers1

2

Both & and ; are command terminators. You use one or the other, but not both.

some_command1 & some_command2

some_commandA ; some_commandB

is the same as

some_command1 &
some_command2

some_commandA ; some_commandB

... but the ; is not needed when it's at the end of the line, so the second set of commands is the same as

some_commandA
some_commandB
Kusalananda
  • 333,661
  • Okay I understand better, I never knew that & is not only to detach but to end the "line" too, thanks! – aaa Jun 26 '21 at 12:02