![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
tee
Someone recently advised me to use the tee command to write to standard out.
Why would you pipe your commands to tee -a <filename> rather than just using >> <filename> ? For example: date|tee -a myfile seems to be the same as date >> myfile Is there a benefit to using tee that I'm not seeing? Thanks, Darin |
|
||||
|
When you need to write a log and put the same data to the tty, then tee is useful. Plus Code:
date > t.lis does not write anything to the tty. All stdout output goes into the file. A best use of tee is: Code:
command 2&>1 | tee -a somelog.file To capture both errors and normal output. This way the person running the script sees what happened. Then support has a log file to refer to as well. |
|
||||
|
I think you missed the main point of Jim's statement:
Quote:
If you want to write to the file, and not see the output then don't use tee, otherwise do. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|