help-bash
[Top][All Lists]
Advanced

[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 10:09:13 +0300



On Mon, May 28, 2012 at 10:04 AM, John Kearney <address@hidden> wrote:
Am 28.05.2012 08:50, schrieb Pierre Gaston:


On Mon, May 28, 2012 at 9:40 AM, John Kearney <address@hidden> wrote:
#!/bin/bash
if ! [ -t 1 ]; then
   exec 3>&1
   exec 1>$(tty)
fi

doing this
1>&-
will close &3 as well.

it won't close 3 why would it? When you duplicate 1 you also close 1 anyway.

I read it somewhere and at the time it seemed correct. Anyway its redundant in the above example anyway?

Yes, you don't need to close it first.
 

reply via email to

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