I'm using tee
as follows:
some commands | tee -a >(command1 >> file) >(command2 >> file) >(command3 >> file)
How can I delay the execution of command2 till command1 ends, and same for command3 and command2? I tried using wait
like this, but it didn't work:
some commands | tee -a >(command1 >> file) >(wait command2 >> file) >(wait command3 >> file)
Looks like there is some logic missing along with syntax errors.
tee -a
will pass output to STDOUT and append simultaneously, no need to use>
And why so many output redirects? May be you should utilize
&&
or;
Not sure what commands you running but below might give you at least an idea.
some commands | tee -a file
will show STDOUT and write to file, regardless of the exit code, because there is;
nextcommand1 >> file
will be executed then command2 and then command3 and so on.Here every command set divided by
;
will be executed in order from left to right and also every command output will be shown in STDOUT