Shell redirections
brandon at tdi2.UUCP
brandon at tdi2.UUCP
Tue Mar 3 06:44:38 AEST 1987
Quoted from <4628 at brl-adm.ARPA> ["Re: INFO-UNIX Digest V3#073"], by black at ee.UCLA.EDU (Rex Black)...
+---------------
| > (cmd 2>&1) | tee log
| > (exec cmd 2>&1) | tee log
| > Well is there some other syntax or funny combination of >|12& to use ?
|
| You betcha! Try
| script |& pipeprog
| or
| script >& logfile
|
| Works for me.
+---------------
No doubt. However, you'll note the ``2>&1'' he used. Believe it or not, he's
running the old-fashioned Bourne shell. And if he is running System V, he
hasn't got much of a choice about it (barring spending mucho $$$ on the Korn
shell, which he said he's already doing; the Korn shell does this the same way
the Bourne shell does).
PLEASE REMEMBER THAT NOT EVERYONE IS RUNNING THE C SHELL UNDER 4.3BSD ON A
VAX!!!!!!!
NB: The way to do it is `(exec 2>&1; exec cmd) | tee log'. This works even
for builtins, and even on pre-System V Bourne shells.
++Brandon
--
``for is he not of the Children of Luthien? Never shall that line fail, though
the years may lengthen beyond count.'' --J. R. R. Tolkien
Brandon S. Allbery UUCP: cbatt!cwruecmp!ncoast!tdi2!brandon
Tridelta Industries, Inc. CSNET: ncoast!allbery at Case
7350 Corporate Blvd. INTERNET: ncoast!allbery%Case.CSNET at relay.CS.NET
Mentor, Ohio 44060 PHONE: +1 216 255 1080 (home) +1 216 974 9210
More information about the Comp.unix.questions
mailing list