Unix and tee — chain of commands Unix and tee — chain of commands unix unix

Unix and tee — chain of commands


It has only the output of the second command, as the semicolon indicates a new statement to the shell.

Just put them into parentheses:

(echo 1; echo 2) | tee file


Try:

 ( echo 1; echo 2 ) | tee file

Without the parentheses, it's getting parsed as:

 echo 1 ; ( echo 2 | tee file )