I am fairly new in bash scripting. I need to use bash script for manage my microservices, so these services need build and deploy(on docker).
So I have commands like that :
#!/bin/bash
mvn clean
wait $!
mvn package
wait $!
#Some if elses here
sudo docker build -t myService . &
wait $!
#Some if elses here
sudo -S docker run -d -name myService myService &
So as you see(a little part of script, i am grouping depended commands in functions),commands need to wait previous depended commands like that. But wait $! command doesn't look nice after all command.
Are there any approaches for this situations?(I am open other approaches instead of bash scripting if it is handy solution. Btw services are node and java services seperated, so I need to start all of them with one bash script.)