Friday, December 08, 2006

Its time for tee

I was asked this question and suddenly i realized that bash doesnt have redirection like operator to do this. Do what? Print Standard Output/Error as it is and also redirect it to a file. So therefore its time for tee.


$ls i_dont_exist 2>&1 | tee output.txt
ls: i_dont_exist: No such file or directory
$cat output.txt
ls: i_dont_exist: No such file or directory

0 Comments:

Post a Comment

<< Home