/ Published in: Python
Spawning shell / command prompt based environment
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/python import os args = "" walk = os.getcwd() while argss != "quit": args = raw_input(""+walk+"> ") if args.split(" ")[0] == "cd": try: os.chdir(args.split(" ")[1]) walk = os.getcwd() except: print "no such command" else: args2 = os.popen(args) print args2.read()