Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!bloom-beacon!eru!luth!sunic!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re: Shell Logging Message-ID: <3763@solo11.cs.vu.nl> Date: 20 Oct 89 15:36:40 GMT References: <355@udcps3.cps.udayton.edu> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 28 selig@udcps3.cps.udayton.edu (Paul D. Selig) writes: \I need to have a way that will take a shell script that is written by a \student and run that script, while at the same time writing all input \(either from the keyboard or a file), output, and error output to a "log" \file, while at the same time accepting input from the keyboard and writing \the output to the screen. [...] /usr/ucb/script would do what you want. If you only want to log error messages, you can use the following script. ----------8<----------8<----------8<----------8<----------8<---------- #!/bin/sh # @(#)log 1.1 89/06/10 Maarten Litmaath # log - save error messages in a logfile, duplicate them on stderr test $# -lt 2 && { echo "Usage: `basename $0` " >&2 exit 1 } ERRLOG=$1 shift exec 3>&1 "$@" 2>&1 >&3 3>&- | tee -a "$ERRLOG" >&2 ----------8<----------8<----------8<----------8<----------8<---------- -- A symbolic link is a POINTER to a file, | Maarten Litmaath @ VU Amsterdam: a hard link is the file system's GOTO. | maart@cs.vu.nl, mcsun!botter!maart