Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!sdd.hp.com!think.com!mintaka!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.questions Subject: Re: using tee program with tar output Message-ID: <1991May10.141751.24649@athena.mit.edu> Date: 10 May 91 14:17:51 GMT References: <26840@adm.brl.mil> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 29 In article <26840@adm.brl.mil>, sean@dmr.asa.com (Sean Baker) writes: |> I'm trying to redirect the output of tar to a file. |> |> I can do this fine in the csh by using: |> |> tar cvf tarfile /tmp |& tee tar.out |> |> But how do I do this with the Bourne shell? I can't seem to |> get both stdin and stdout sent to the tee program? Your question is very confused. If you are asking how to direct both the standard output and the standard error of a command to a file, which is what the "tar" example you gave does, in the bourne shell, then the last bit about "stdin and stdout" does not belong. The answer to the question, in any case, is "tar cvf tarfile 2>&1 | tee tar.out". See the man page for sh. If you are asking how to record both what is typed at a command and what is printed by it as output, then the part of your question about "stdin and stdout" makes sense, but the first part of it does not, because the tar command you gave does NOT do that. In any case, the answer to the question is to use something like "script" which will record a login session. -- Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710