Я использую tee
следующим образом:
some commands | tee -a >(command1 >> file) >(command2 >> file) >(command3 >> file)
Как я могу отложить выполнение команды2 до конца команды1, и то же самое для команды3 и команды2? Я попытался использовать wait
, как это, но это не сработало:
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; command1 >> file; command2 >> file; command3 >> file
some commands | tee -a file
will show STDOUT and write to file, regardless of the exit code, because there is ;
next command1 >> file
will be executed then command2 and then command3 and so on.
some commands | tee -a file; command1 | tee -a file; command2 | tee -a file; command3 | tee -a file
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