Add take script

Reads N arguments from stdin and prints them
This commit is contained in:
Talia 2019-07-24 10:50:34 +02:00
parent 37884e03ac
commit 6b3f339593
1 changed files with 20 additions and 0 deletions

20
bin/take Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env lua
local num, command = ..., table.concat({select(2, ...)}, ' ')
local input do
if command == '' then
input = io.stdin
else
input = io.popen(command)
end
end
for i=1,num do
local input = input:read '*l'
if input then
print(input)
else
break
end
end