Advertisement
jille_Jr

CC: which.lua

Nov 15th, 2020
672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.28 KB | None | 0 0
  1. local args = {...}
  2.  
  3. if #args == 0 then
  4.     error("usage: which <program>", 0)
  5. end
  6.  
  7. local result = shell.resolveProgram(args[1])
  8.  
  9. if result == nil then
  10.     error(table.concat {
  11.         '"',
  12.         args[1],
  13.         '" not found'
  14.     }, 0)
  15. end
  16.  
  17. write '/'
  18. print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement