[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] redirection - stdout
From: |
Pierre Gaston |
Subject: |
Re: [Help-bash] redirection - stdout |
Date: |
Mon, 28 May 2012 16:25:32 +0300 |
On Mon, May 28, 2012 at 4:15 PM, Bill Gradwohl <address@hidden> wrote:
> On Mon, May 28, 2012 at 12:50 AM, Pierre Gaston <address@hidden>
> wrote:
>>
>>
>> it won't close 3 why would it? When you duplicate 1 you also close 1
>> anyway.
>>
>> you can also use the standard /dev/tty , eg 1>/dev/tty
>
>
> Pierre.
>
> Greg's wiki says it duplicates the fd and specifically says both remain
> open. I'll have to test this.
Well, yes but I was more talking about the old "3", if you do:
exec 3>file
exec 3>&1
Then on the second line 3 is closed and then made a duplicate of 1, so
you have a new 3 and a 1 opened, but the old 3 opened on file has been
closed.
You don't need to do it by hand like (it's done for you):
exec 3>file
exec 3>&-
exec 3>&1