1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-05 08:26:16 +00:00
opus/apps/cat.lua
kepler155c@gmail.com fc243a9c12 Initial commit
2016-12-11 14:24:52 -05:00

24 lines
389 B
Lua

local args = { ... }
if #args < 1 then
error('cat <filename>')
end
local fileName = shell.resolve(args[1])
if not fs.exists(fileName) then
error('not a file: ' .. args[1])
end
local file = fs.open(fileName, 'r')
if not file then
error('unable to open ' .. args[1])
end
while true do
local line = file.readLine()
if not line then
break
end
print(line)
end
file.close()