Bash script execution order

Do strings in a bash script execute sequentially? I see no reason why not, but I'm really new to the bash script, and I have a couple of commands that need to be executed in order.

For instance:

#!/bin/sh
# will this get finished before the next command starts?
./someLongCommand1 arg1
./someLongCommand2 arg1
+3
source share
2 answers

Yes ... if you do not miss your way to execute one of the commands in the background, one will be completed before the next start.

+4
source

Yes, they are executed sequentially. However, if you run the program in the background, the next command in your script runs immediately after the background command is run.

#!/bin/sh
# will this get finished before the next command starts?
./someLongCommand1 arg1 &
./someLongCommand2 arg1 &

script; . ( , (&) .

+3

Source: https://habr.com/ru/post/1780334/


All Articles