|
From: | John Kearney |
Subject: | Re: [Help-bash] redirection - stdout |
Date: | Mon, 28 May 2012 08:40:39 +0200 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 |
#!/bin/bash if ! [ -t 1 ]; then exec 3>&1 exec 1>$(tty) fi doing this 1>&- will close &3 as well. note doing this exec 1>/dev/fd/1 is the same as doing this exec 1>&1 Am 28.05.2012 04:32, schrieb Bill Gradwohl: I'm trying to detect when a scripts stdout is redirected, and then create another fd to accept the redirection but put fd 1 back to the terminal. I need fd 1 & fd 2 pointing at the terminal and fd 3 pointing at the file. All of them open at the same time. |
[Prev in Thread] | Current Thread | [Next in Thread] |