I would like to run two commands in bash at the same time, wait for the success of both, and then run a third command. In addition, I would like to include this into a time command. Schematically:
time { { cmd_1 & cmd_2 & } && cmd 3; } &> time.log
If, for example, I run:
time { { echo "hi" & sleep 5 & } && echo "ok"; } &> time.log
I get "ok" printed out immediately, without waiting for the success of the commands between curly brackets. Moreover, the time.log file contains the standard error and standard output of the two commands in brackets but the output of time is printed in the terminal only, not in the file.
I am sure I am missing something clear and easy!