I have a shell script which looks like this:
echo firstOutput read -s command0 command1a command1b command1c echo secondOutput command2
command1c are individual commands but they can be executed in arbitrary order and are a group in the sense of the following explanation.
I now want to improve it so the script continues even if one command gets stuck.
command0 needs to be executed first and it got 8 seconds to operate. If it doesn't make it within 8 seconds, the script shall continue to
command1[a-c] which together have 5 seconds to operate. If they don't terminate within the given 5 seconds,
command2 shall be called. Just in case this matters:
command2 is the last command of this script.
Edit: To clarify: I know how to make a script which executes the commands in the maximum time allowed. However, these are timeouts and I want the script to run through as fast as possible. The entire script usually runs through in a fraction of a second after enter is pressed (see line