Do both bash and sh wait for a command to terminate before executing the next one?
I have run some scripts when I expected commands to execute one after the other (ie commands on different lines) but it didn’t seem to work that way. I can’t recollect the exact scripts offhand but I separated the commands with the && symbol.
If you cut and paste lines from a script of a how to into a terminal is it guaranteed that earlier lines will finish before the following lines?
If you have pipes
|or background jobs&, then the evaluation may be non-sequential, otherwise it does evaluate things one after the other.However, if the output is in different streams, they could be coming to the console out of order. For instance, if you print to both STDOUT and STDERR, the lines within each streams will be in order, but they might be interleaved in a way that does not reflect the order printing was done in the code.