[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Detecting Redirection in Bash

From: Carol Anne Ogdin
Subject: Detecting Redirection in Bash
Date: Mon, 10 Mar 2003 16:47:55 -0800

Dear bash guru(s):

I'm trying to figure out how to make all stdout (e.g., from an echo command) go out to the same file where bash's output is being redirected.  In other words, is there any way to direct stdout to the redirected stdout of a executing shell, so the script, each line's evaluation, all stdout and stderr output goes to a single text file?  I'd like to see it all in one file for debugging

Here's a theoretical example of what I want to do::
>bash -vx mybash >mytrace.txt
Where the "mybash" script contains
  echo "I'm in the same file as the bash trace!" >>mytrace.txt 2>&1

Now, I know this doesn't work (bash 2.05a), but it illustrates my goal.  Does anybody know how to make this happen?

--Carol Anne

reply via email to

[Prev in Thread] Current Thread [Next in Thread]