Results 1 to 3 of 3
I want to have the output of a program go to 2 different files but not going to standard out. Is there a way to do this in bash? I ...
- 03-24-2011 #1Just Joined!
- Join Date
- Apr 2010
- Posts
- 15
[SOLVED] Pipe output to 2 files but not STDOUT
I want to have the output of a program go to 2 different files but not going to standard out. Is there a way to do this in bash? I know that in Z shell its really easy. Something like:
Would work. But in Bash it doesn't seem that easy. I know that tee will send the output to 2 files but it also sends it to STDOUT. Something like:Code:echo "test" >> file1 >> file2
Would put the word "test" in file1, file2, and STDOUT. Is there a way to just send the output to file1 and file2?Code:echo "test" | tee -a file1 file2
Anyway thanks in advance for any suggestions.
- 03-25-2011 #2Linux Newbie
- Join Date
- Mar 2009
- Posts
- 228
You could do this:
or this:Code:echo "test" | tee -a file1 file2 > /dev/null
Code:echo "test" | tee -a file1 >> file2
- 03-25-2011 #3Just Joined!
- Join Date
- Apr 2010
- Posts
- 15
Thanks works perfectly!


