bug-bash
[Top][All Lists]
Advanced

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

Re: trap handler scope wrong?


From: Chet Ramey
Subject: Re: trap handler scope wrong?
Date: Sun, 05 Mar 2006 20:54:12 -0500
User-agent: Thunderbird 1.5 (Macintosh/20051201)

Phillip Susi wrote:
> Does redirecting to /dev/tty work if the original stdout of the shell
> was NOT a tty?  This script runs as a cron job so it has no tty.

Probably won't work to use /dev/tty in that case.

> Also is there a better way to save the original stdout and switch back
> to it than this:
> 
> trap "cat $LOG > &3" ERR
> {
>  foo
>  bar
> } 3>&1 > /dev/null

That's about right, but you need >&3 in the trap command.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                           Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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