/ Published in: Bash
Execute multiple commands in background, wait for each to be finished and evaluate their return codes.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/bash /bin/false & PID1=$! /bin/true & PID2=$! wait $PID1 RET1=$? wait $PID2 RET2=$? if [ $RET1 == 0 ] && [ $RET2 == 0 ]; then echo succeeded exit 0 else echo failed exit 1 fi