I have a BASH to run 3 functions in parallel in my BASH.
functionA () {
......
my command || { echo "ERROR!!" >> $LOG_FILE ; exit 1 ;}
}
functionB () {
......
my command || { echo "ERROR!!" >> $LOG_FILE ; exit 1 ;}
}
functionC () {
......
my command || { echo "ERROR!!" >> $LOG_FILE ; exit 1 ;}
}
functionA &
functionB &
functionC &
wait
I have some commands in all functions for Error handling like this:
my command || { echo "ERROR!!" >> $LOG_FILE ; exit 1 ;}
I noticed even though I have exit 1 for Error handling in all functions but the other functions still keep going. How do I stop bash and return exit code 1 if any of the functions fail?
I am very new to BASH, any help is appreciated!