stacym@hpldsla.HP.COM (06/09/89)
Hello, Here's a question to anyone listening......... I run a program on my machine called FBACKUP within a shell. For those who don't know, FBACKUP is a backup utility. Anyways, occasionally I receive some error messages from the utility. I would like to be able to see these messages on the console as they come out, but I would also like to be able to collect these messages within a file. From what I have been able to tell, I can redirect the error output to a file by use of 2> filename, but then I can not see the error messages on the screen. Anyone got any answers??? Thanks for the time. Stacy Martin ================================== When using DOS, CTRL-ALT-DEL always deletes the current line.
maart@cs.vu.nl (Maarten Litmaath) (06/10/89)
stacym@hpldsla.HP.COM writes: \... \ For those who don't know, FBACKUP is a backup utility. Really? I'd have sworn it was an editor! :-) \ Anyways, occasionally I receive some error messages from the \ utility. I would like to be able to see these messages on \ the console as they come out, but I would also like to \ be able to collect these messages within a file. From \ what I have been able to tell, I can redirect the error output \ to a file by use of 2> filename, but then I can not see the \ error messages on the screen. [...] Example: $ cat foo hello world $ log errors cat foo bar hello world bar: No such file or directory $ cat errors bar: No such file or directory $ log errors 'Pointer Addition' $ cat errors bar: No such file or directory Pointer Addition: Protocol not supported $ Script: ----------8<----------8<----------8<----------8<----------8<---------- #!/bin/sh # @(#)log 1.0 89/06/10 Maarten Litmaath # log - save error messages in a logfile, duplicate them on stderr test $# -lt 2 && { echo "Usage: `basename $0` <error logfile> <command>" >&2 exit 1 } ERRLOG=$1 shift exec 3>&1 "$@" 2>&1 >&3 | tee -a "$ERRLOG" >&2 ----------8<----------8<----------8<----------8<----------8<---------- \... \ When using DOS, CTRL-ALT-DEL always deletes the current line. When using SunOS 3.5 "date > /dev/printer" will get you out of the editor. rot13: qba'g qb guvf ng ubzr, xvqf... -- "Your password [should be] like your |Maarten Litmaath @ VU Amsterdam: toothbrush." (Don Alvarez) |maart@cs.vu.nl, mcvax!botter!maart