#! / usr / bin / python
# - * - CODING: CP936 - * -
#############################################################
# Written by caocao # #
# caocao@eastday.com # #
# http://nethermit.yeah.net #
#############################################################
IMPORT OS
Import sys
IMPORT STRING
IMPORT RE
Print "Written by Caocao"
Print "caocao@eastday.com"
Print "http://nethermit.yeah.net"
if os.name == "NT":
Print "OS: Windows NT"
Else:
Print "OS: Unknown"
Print "Python Shell Version 1.0"
While True:
TRY:
Command = string.strip (Raw_INPUT ("PS" OS.Getcwd () ">"), "")
CommandLow = String.Lower (Command)
Except EofError:
Break
Else:
if CommandLow == "exit" or commandlow == "quit":
Break
Elif commandlow == "":
Continue
Elif Re.match ("^ [A-Z] {1}: $", command, re.i)! = none:
TRY:
Os.chdir (Command)
Except Oserror:
Print "No Such File or Directory"
Elif Re.match ("^ CD (. ) $", Command, Re.i)! = None:
MatchObject = Re.Search ("^ CD (. ) $", Command, Re.i)
if MatchObject! = None:
TRY:
Os.chdir (MatchObject.group (1))
Except Oserror:
Print "No Such File or Directory"
Else:
Print "Bad Command"
Else:
Os.System (Command)
Print "Byebye!"