xXm0dzXx

Untitled

Jun 2nd, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. bExit = false
  2. print( os.version() )
  3.  
  4. local tCommandHistory = {}
  5. while not bExit do
  6. write( shell.dir() .. "> " )
  7.  
  8. local sLine = read( nil, tCommandHistory )
  9. table.insert( tCommandHistory, sLine )
  10.  
  11. local tWords = {}
  12. for match in string.gmatch(sLine, "[^ \t]+") do
  13. table.insert( tWords, match )
  14. end
  15.  
  16. local sCommand = tWords[1]
  17. if sCommand then
  18. shell.run( sCommand, unpack( tWords, 2 ) )
  19.  
  20. if fs.exists( sCommand ) or fs.exists( "rom/programs/ ..sCommand ) then
  21. term.redirect(peripheral.wrap("right"))
  22. shell.run( sCommand, unpack( tWords, 2) )
  23. term.restore()
  24. end
  25. end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment