asteroidsteam icon

shell

asteroidsteam | PRO | 10/29/17 06:18:47 PM UTC | 0 ⭐ | 594 👁️ | Never ⏰ | []
Lua |

1.09 KB

|

None

|

0 👍

/

0 👎

function initShell()
    term.clear()
    term.setCursorPos(1,1)
    term.setTextColor(colors.red)
    print("J:OS Shell 1.0")
end
function shell_CMD()
    term.setTextColor(colors.orange)
    local machine = os.getComputerLabel()
    if (machine == nil) then
      os.setComputerLabel(jsof.getId())
      machine = os.getComputerLabel()
    end
    write(machine..".local@j-os:/"..shell.dir().."$ ")
    term.setTextColor(colors.yellow)
    input = read()
    banned_cmds = {
      "rm startup",
      "rm start.scr",
      "rm key",
      "rm rom-3",
      "rm ASSETS",
      "rm apis",
      "rm loginkeys",
      "rm os",
      "rm rom",
      "edit startup",
      "edit start.scr",
      "edit key",
      "cd rom-3",
      "cd ASSETS",
      "cd apis",
      "cd os",
      "cd rom",
      "multishell",
      "cd sys",
      "rm sys"
    }
    isbanned = false
    for i=1,#banned_cmds do
        if (input == banned_cmds[i]) then
          isbanned = true
          term.setTextColor(colors.red)
          print("Error: That file is locked!")
        else
        end
    end
    if (isbanned == false) then
      shell.run(input)
    end
end
initShell()
while true do
    shell_CMD()
end

Comments