local args = {...} if #args == 0 then error("usage: which ", 0) end local result = shell.resolveProgram(args[1]) if result == nil then error(table.concat { '"', args[1], '" not found' }, 0) end write '/' print(result)