Advertisement
asteroidsteam

shell

Oct 29th, 2017
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. function initShell()
  2.     term.clear()
  3.     term.setCursorPos(1,1)
  4.     term.setTextColor(colors.red)
  5.     print("J:OS Shell 1.0")
  6. end
  7. function shell_CMD()
  8.     term.setTextColor(colors.orange)
  9.     local machine = os.getComputerLabel()
  10.     if (machine == nil) then
  11.       os.setComputerLabel(jsof.getId())
  12.       machine = os.getComputerLabel()
  13.     end
  14.     write(machine..".local@j-os:/"..shell.dir().."$ ")
  15.     term.setTextColor(colors.yellow)
  16.     input = read()
  17.     banned_cmds = {
  18.       "rm startup",
  19.       "rm start.scr",
  20.       "rm key",
  21.       "rm rom-3",
  22.       "rm ASSETS",
  23.       "rm apis",
  24.       "rm loginkeys",
  25.       "rm os",
  26.       "rm rom",
  27.       "edit startup",
  28.       "edit start.scr",
  29.       "edit key",
  30.       "cd rom-3",
  31.       "cd ASSETS",
  32.       "cd apis",
  33.       "cd os",
  34.       "cd rom",
  35.       "multishell",
  36.       "cd sys",
  37.       "rm sys"
  38.     }
  39.     isbanned = false
  40.     for i=1,#banned_cmds do
  41.         if (input == banned_cmds[i]) then
  42.           isbanned = true
  43.           term.setTextColor(colors.red)
  44.           print("Error: That file is locked!")
  45.         else
  46.         end
  47.     end
  48.     if (isbanned == false) then
  49.       shell.run(input)
  50.     end
  51. end
  52. initShell()
  53. while true do
  54.     shell_CMD()
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement