Bash – Executing Consecutive Commands

bash

Am I correct to assume that when ; joins two commands on a line, Bash always waits until the first command has exited before executing the second command?
And similarly, in a shell script containing two different commands on different lines, Bash always waits until the command on the first line has exited before executing the command on the second line?

If this is the case, is there a way to execute two commands in one line or in a script, so that the second command doesn't wait until the first command has finished?

Also, are different lines in a shell script equivalent to separate lines joined by ; or &&?

Best Answer

You're correct, commands in scripts are executed sequentially by default.

You can run a command in the background by suffixing it with & (a single ampersand).

Commands on separate lines are equivalent to commands joined with ; by default. If you tell your shell to abort on non-zero exit codes (set -e), then the script will execute as though all the commands were joined with &&.