help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] redirection - stdout


From: John Kearney
Subject: Re: [Help-bash] redirection - stdout
Date: Mon, 28 May 2012 09:04:43 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

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?
you can also use the standard /dev/tty , eg 1>/dev/tty


--
View
          John Kearney's profile on LinkedIn John
          Kearney

reply via email to

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