Advertisement
xXm0dzXx

Untitled

May 29th, 2012
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. local bExit = false;
  2. fs.makeDir(".taskprograms")
  3. local files = fs.list(".taskprograms")
  4.  
  5. function isTasked(programname)
  6. return fs.exists(".taskprograms/" ..programname)
  7. end
  8.  
  9. local run = function()
  10. shell.run("clear") --Just trying to be lazy and expose you to viruses :)
  11. print(os.version())
  12.  
  13. for i = 1,#files do
  14. shell.run(".taskprograms/" ..files[i])
  15. end
  16.  
  17. print("Background Programs: ")
  18.  
  19. for i = 1,#files do
  20. write(files[i].. ", ")
  21. end
  22.  
  23.  
  24. local tCommandHistory = {}
  25. while not bExit do
  26. write( shell.dir() .. "> " )
  27.  
  28. local sLine = read( nil, tCommandHistory )
  29. table.insert( tCommandHistory, sLine )
  30.  
  31. local tWords = {}
  32. for match in string.gmatch(sLine, "[^ \t]+") do
  33. table.insert( tWords, match )
  34. end
  35.  
  36. local sCommand = tWords[1]
  37. if sCommand then
  38. if sCommand == "/mult" then
  39. if tWords[2] then
  40. if fs.exists(".taskprograms/" ..tWords[2]) then
  41. print("Already added!")
  42. else
  43. if fs.exists(tWords[2]) then
  44. fs.copy(tWords[2], ".taskprograms/" ..tWords[2])
  45. print("Added!")
  46. shell.run(tWords[2])
  47. else
  48. print("No such program (" ..tWords[2].. ")")
  49. end
  50. end
  51. else
  52. print("Usage: /mult <file name>")
  53. end
  54. else
  55. shell.run( sCommand, unpack( tWords, 2 ) )
  56. end
  57. end
  58. end
  59. end
  60.  
  61. run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement