Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- olddelete = fs.delete
- oldterminate = os.pullEvent
- os.pullEvent = os.pullEventRaw
- function removefile(filename)
- if filename == "startup" then
- error("Access Denied")
- else
- olddelete(filename)
- end
- end
- fs.delete = removefile
- local bExit = false
- term.clear()
- term.setCursorPos(1,1)
- print(os.version().. " - Used PC")
- -- Read commands and execute them
- local tCommandHistory = {}
- while not bExit do
- write( shell.dir() .. "> " )
- local sLine = read( nil, tCommandHistory )
- table.insert( tCommandHistory, sLine )
- local tWords = {}
- for match in string.gmatch(sLine, "[^ \t]+") do
- table.insert( tWords, match )
- end
- local sCommand = tWords[1]
- if sCommand then
- if sCommand == "edit" and tWords[2] == "startup" then
- print("Access Denied")
- else
- os.pullEvent = oldterminate
- shell.run( sCommand, unpack( tWords, 2 ) )
- os.pullEvent = os.pullEventRaw
- end
- end
- end
Add Comment
Please, Sign In to add comment