#!bin/python
###################################
# Written by : StrikerX
# Date : May 10 07
# Purpose : simple Shell in Python
###################################
from os import * # to use getcwd(), listdir(), chdir(), system() .
from sys import * # to use exit().
print "Welcome to Python Shell ! "
command = ""
while (command != "exit"):
command = raw_input(getcwd() + " %>#")
command = command.strip()
if command.strip()[:2] == 'cd':
chdir(command.strip()[3:]) #getting the Path to be changed 2 !
elif command == "ls":
for x in listdir(getcwd()):
print x
else:
system(command)
print "you are logging out of Python Shell ! "
exit() #EXIT
StrikerX
0
Newbie Poster
ffao
10
Newbie Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
ffao
10
Newbie Poster
Lardmeister
commented:
nice ideas
+10
bumsfeld
413
Nearly a Posting Virtuoso
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
shadwickman
159
Posting Pro in Training
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
bumsfeld
413
Nearly a Posting Virtuoso
Ene Uran
638
Posting Virtuoso
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
bumsfeld
413
Nearly a Posting Virtuoso
scru
909
Posting Virtuoso
Featured Poster
tomoconnell
0
Newbie Poster
sneekula
969
Nearly a Posting Maven
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
Begjinner
0
Light Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
ZZucker
342
Practically a Master Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
Ene Uran
638
Posting Virtuoso
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
ZZucker
342
Practically a Master Poster
ZZucker
342
Practically a Master Poster
Ene Uran
638
Posting Virtuoso
lllllIllIlllI
178
Veteran Poster
Lardmeister
461
Posting Virtuoso
ZZucker
342
Practically a Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.