If a command is terminated by the control operator ‘&’, the shell executes the command asynchronously in a subshell.
This is known as executing the command in the background, and these are referred to as asynchronous commands.
The shell does not wait for the command to finish, and the return status is 0 (true).
Commands separated by a ‘;’ are executed sequentially; the shell waits for each command to terminate in turn.
The return status is the exit status of the last command executed.
command1 && command2
#command2 is executed if, and only if, command1 returns an exit status of zero (success).
command1 || command2
#command2 is executed if, and only if, command1 returns a non-zero exit status.
Shell Commands
最新推荐文章于 2024-06-16 23:26:06 发布