Find the answer to your Linux question:
Results 1 to 4 of 4
Hello all, I am again struggling to make a script work, but hey, it is fun, I am learning new things. I discovered the set -x option which was, for ...
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    6

    How to redirect ALL output to a (log) file

    Hello all,

    I am again struggling to make a script work, but hey, it is fun, I am learning new things.

    I discovered the set -x option which was, for me, like the second coming.

    Still, what I am not able to do is redirect ALL output to a (log) file, including what is produced by the -x setting.

    Let's assume a very simple script:
    Code:
    #!/bin/bash
    set -x
    source="/home/atelier/Bureau/"
    ls -la $source
    and I am running it as . test.sh >> /var/log/test.rmcb.log

    The result of ls goes inded into the log file, but the rest still shows on the console where I am running the script:
    Code:
    ++ source=/home/atelier/Bureau/
    ++ ls --color=auto -la /home/atelier/Bureau/
    Is there a way to redirect EVERYTHING to the log file ?
    Any ideas ?
    Thanks in advance,
    rmcb

  2. #2
    Linux Engineer Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    855

  3. #3
    Just Joined!
    Join Date
    Jan 2009
    Posts
    6
    Thx.
    Solved. I didn't know that the + output was STDERR

  4. #4
    Linux Engineer Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    855
    You are welcome!

Posting Permissions

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