Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    [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:

    Code:
    echo "test" >> file1 >> file2
    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" | tee -a 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?

    Anyway thanks in advance for any suggestions.

  2. #2
    You could do this:

    Code:
    echo "test" | tee -a file1 file2 > /dev/null
    or this:

    Code:
    echo "test" | tee -a file1 >> file2

  3. #3
    Thanks works perfectly!

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •