I am writing this so when other people google how to do it, they have something to find to save them time.
For days I tried to figure out how to make sure a command finished before another was run. I couldn’t find any information anywhere. If you are like me you may be thinking ( or wondering if ) that the shell just zooms through the commands you put in a script file without waiting for each to finish. It seems like this because everything is rushing by so quickly you can’t read it.
For days I was running scripts to install and configure my servers and it kept hanging so bad I couldn’t even ping the server.
I was running the following for example
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get reboot
And since my server instances were hard freezing right up, I figured it must be zooming right on through causing an error.
Well come to find out after much research and someone on twitter finally confirmed to me that the shell automatically waits for each command to finish before executing the next. The shell doesn’t automatically run all commands encountered at the same time.
Now I must figure out what is actually locking my server instances up.