Phillip Susi wrote:
> Chet Ramey wrote:
>>> trap "cat $LOG > &3" ERR
>>> {
>>>  foo
>>>  bar
>>> } 3>&1 > /dev/null
>>
>> That's about right, but you need >&3 in the trap command.
> 
> I did have > &3 in the trap command, see?

There can't be a space between `>' and `&'.  That's a syntax error.

> I'm a bit worried though about hard coding the fd 3.  Is there a way to
> get the next available fd number and save it in a variable, rather than
> hard code 3?

Why worry about it?  The script writer is entitled to use any file
descriptor between 0 and 9.  If bash is using it internally, it will
switch to another.

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    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to