Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Bash by Zeus
- os.loadAPI("/lib/text/textlib")
- pathfile = fs.open("/etc/environment", "r")
- pathstr = pathfile.readAll()
- pathfile.close()
- path = string.gsub(pathstr, "PATH=", "")
- path = string.gsub(path, "\"", "")
- paths = textlib.split(":", path)
- while true do
- userfile = fs.open("/etc/user", "r")
- cUser = userfile.readAll()
- userfile.close()
- hostfile = fs.open("/etc/hostname", "r")
- hostname = hostfile.readAll()
- hostfile.close()
- term.setTextColor(colors.lime)
- term.write(cUser)
- term.write("@")
- term.write(hostname)
- term.setTextColor(colors.white)
- term.write(":")
- term.setTextColor(colors.blue)
- if shell.dir() == "home/"..cUser then
- term.write("~ ")
- else
- term.write("/"..shell.dir().." ")
- end
- term.setTextColor(colors.blue)
- term.write("$ ")
- term.setTextColor(colors.white)
- inp = read()
- cmd = textlib.split(" ", inp)
- trovato = false
- if string.sub(inp, 1, 2) == "./" then
- for i=0, #inp do
- if i == 1 and inp[i] == "." then
- inp[i] = ""
- end
- if i == 2 and inp[i] == "/" then
- inp[i] = ""
- end
- end
- cmd = textlib.split(" ", inp)
- cmd[1] = shell.resolve(cmd[1])
- if shell.run(unpack(cmd)) then
- trovato = true
- end
- end
- for i, k in pairs(paths) do
- 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
- shell.run(unpack(tabcmd))
- trovato = true
- end
- end
- if not trovato then
- print("Programma non trovato")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment