cat now inserts a newline at the end of the file if there isn't one already
This commit is contained in:
@@ -15,11 +15,16 @@ for _, file in pairs(args) do
|
||||
terminal.write("\27[91mCan't open " .. file .. "\27[0m\n")
|
||||
goto continue
|
||||
end
|
||||
local enddata
|
||||
while true do
|
||||
local data = handle:read(math.huge or math.maxinteger)
|
||||
if data == nil then break end
|
||||
terminal.write(data)
|
||||
enddata = data
|
||||
end
|
||||
handle:close()
|
||||
if string.sub(enddata, -1, -1) ~= "\n" then
|
||||
print("")
|
||||
end
|
||||
::continue::
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user