Find the answer to your Linux question:
Results 1 to 3 of 3
Hello everyone, I have a script that generates a bunch of output, including the expansions details provided by: set -v -x I am trying to pipe everything that is displayed ...
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    6

    [SOLVED] bash: capture all output to a log

    Hello everyone,

    I have a script that generates a bunch of output, including the expansions details provided by: set -v -x

    I am trying to pipe everything that is displayed to a file, in addition to displaying it on the screen. I've managed to get stderr and stdout into the file, but the expansions are only printed to the screen. Here is what I have so far:

    sudo -u <user> source my_job.sh |tee my_log.txt 2>&1

    Can anyone help? Is there another stream I am missing? Thanks in advance!

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    Try this:

    sudo -u <user> source my_job.sh 2>&1 | tee my_log.txt

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    6
    It worked! Thanks so much!

Posting Permissions

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