abstract_abstract

cat.lua

Oct 6th, 2024
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.30 KB | None | 0 0
  1. local args = { ... }
  2.  
  3. if #args == 0 then
  4.     print("Usage: cat <filename>")
  5.     return
  6. end
  7.  
  8. local filename = args[1]
  9. local file = fs.open(filename, 'r')
  10.  
  11. if not file then
  12.     print("File not dound: " .. filename)
  13.     return
  14. end
  15.  
  16. local content = file.readAll()
  17. file.close()
  18. print(content)
  19.  
  20.  
Add Comment
Please, Sign In to add comment