|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
For redirecting STDOUT & STDERR to both screen and logfile, I use the following method : tee {logfile} >/dev/tty |& exec 1>&p 2>&1 This works fine for non-interactive scripts. But when I use this in an interactive script, the user input (STDIN goten from the terminal) does not go into the logfile, but is displayed on screen. Can anyone tell me what to set in order for STDIN to be displayed on the terminal and to go into the log file? Thanks in advance. Mark |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
In article
<0752b97b-1a76-446b-868f-d7c61218cf6f@q39g2000hsf.googlegroups.com>, huijstee@hotmail.com wrote: > Hi, > > For redirecting STDOUT & STDERR to both screen and logfile, I use the > following method : > > tee {logfile} >/dev/tty |& > exec 1>&p 2>&1 > > This works fine for non-interactive scripts. But when I use this in an > interactive script, the user input (STDIN goten from the terminal) > does not go into the logfile, but is displayed on screen. > > Can anyone tell me what to set in order for STDIN to be displayed on > the terminal and to go into the log file? There's no automatic way to do this that I know of. You're redirecting output, the user's typing is input. It's only being seen because of the terminal driver's echoing, it's not actually being written to stdout. Why don't you run your application under script to log everything? -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
huijstee@hotmail.com wrote:
> Hi, > > For redirecting STDOUT & STDERR to both screen and logfile, I use the > following method : > > tee {logfile} >/dev/tty |& > exec 1>&p 2>&1 > > This works fine for non-interactive scripts. But when I use this in an > interactive script, the user input (STDIN goten from the terminal) > does not go into the logfile, but is displayed on screen. > > Can anyone tell me what to set in order for STDIN to be displayed on > the terminal and to go into the log file? > > > Thanks in advance. > > Mark You'd need to run an external tool like "screen", "script" or "hrdcpy" which log the user input and tool output. Ed. |
|
![]() |
| Outils de la discussion | |
|
|