home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d8xx
/
d811
/
bsh.lha
/
bsh
/
tee
< prev
next >
Wrap
Text File
|
1993-02-14
|
909b
|
38 lines
local j f l mode IFS
IFS="\n",f=0
if #argv==1
label usage
echo "usage: tee <file1 >file2 [-a] file3"
return 10
endif
onerr goto err
onintr goto err
j=1,mode="w"
while j<#argv
if argv[j]=="-a"
mode="a",j++
elseif f
goto usage
else
if (f=open(argv[j],mode)) == 0
echo >&2 cant open $argv[$j]
goto err
endif
j++
endif
endwhile
while 1;read l;if eof(0);break;endif;echo $l;echo >&$f $l;endwhile
label err
onintr return
close $f
return
# tee - copies standard input to standard output and one other file.
# tee is really used to split PIPElines:
# % ls | tee con:0/0/400/100/files | zoo aI foo.zoo
# to see the list of files being passed to zoo.
#
# Tee is presented as is; no warrantee is either expressed or implied
# as to it's suitability to any purpose whatsoever. You assume all the
# risk for all damage, even if caused by a defect in the software,
# no matter how awful.