Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function runcmd(inp)
- cmd = textlib.split(" ", inp)
- trovato = false
- if string.sub(inp, 1, 2) == "./" then
- inp2 = string.gsub(inp, "./", "", 1)
- cmd = textlib.split(" ", inp2)
- cmd[1] = "/"..libshell.dir().."/"..cmd[1]
- tRun = ""
- for i, k in pairs(cmd) do
- if tRun ~= "" then
- tRun = tRun.." "..k
- else
- tRun = tRun..k
- end
- end
- libshell.run(tRun)
- trovato = true
- else
- for i, k in pairs(paths) do
- if cmd[1] == nil then
- cmd[1] = ""
- end
- if fs.exists(k.."/"..cmd[1]) then
- tabcmd = {}
- inp = k.."/"..inp
- cmd = textlib.split(" ", inp)
- for i, k in pairs(cmd) do
- table.insert(tabcmd, k)
- end
- tRun = ""
- for i, k in pairs(tabcmd) do
- if tRun ~= "" then
- tRun = tRun.." "..k
- else
- tRun = tRun..k
- end
- end
- string.gsub(tRun, "%s+", "")
- libshell.run(tRun)
- trovato = true
- end
- end
- end
- if not trovato then
- print(cmd[1]..": comando non trovato")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment