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 09:50:36 +0300



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.

you can also use the standard /dev/tty , eg 1>/dev/tty

reply via email to

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