Add tee utility
This commit is contained in:
parent
3866bec55e
commit
761eb0a5e6
3 changed files with 24 additions and 4 deletions
11
cat.nim
11
cat.nim
|
|
@ -3,8 +3,13 @@ import common
|
|||
|
||||
proc main(files:seq[string]) =
|
||||
for file in files:
|
||||
var s = newFileStream(file, fmRead)
|
||||
while not s.atEnd:
|
||||
write(stdout, s.readChar)
|
||||
if file == "-":
|
||||
var line = ""
|
||||
while stdin.readLine(line):
|
||||
echo line
|
||||
else:
|
||||
var s = newFileStream(file, fmRead)
|
||||
while not s.atEnd:
|
||||
write(stdout, s.readChar)
|
||||
|
||||
dispatch(main, version=("version", nimbaseVersion))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue