Advertisement
Guest User

Untitled

a guest
Jul 29th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. from cmd import Cmd
  2. from Queue import Queue
  3. import os
  4.  
  5. class MyShell(Cmd):
  6.     def do_cd(self, *args):
  7.         os.chdir(args[0])
  8.                
  9.     def do_pwd(self, args):
  10.         """Prints the working directory"""
  11.         print os.getcwd()
  12.  
  13.     def do_quit(self, args):
  14.         """Quits the program."""
  15.         print "Quitting."
  16.         raise SystemExit
  17.  
  18.  
  19. if __name__ == '__main__':
  20.     prompt = MyShell()
  21.     prompt.prompt = '> '
  22.     prompt.cmdloop('Starting prompt...')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement