bug-bash
[Top][All Lists]
Advanced

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

redirecting "set -x" output to a file


From: Brian J . Murrell
Subject: redirecting "set -x" output to a file
Date: Wed, 13 Oct 2004 18:36:23 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

I want to do the following in a script:

----- cut -----
#!/bin/bash

exec 2>/tmp/script.debug
set -x

...
----- cut -----

but I don't want any other commands's stderr in the /tmp/script.debug file.  So
somehow I need to move/duplicate file descriptors so that the current shell's
stderr goes into the /tmp/script.debug file but restores stderr to file
descriptor 2 for everything else remaining to use.

I have tried a zillion incarnations of "exec"ing fds around and cannot seem to
quite figure it out.

Thanx,
b.






reply via email to

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