Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Nov 25th, 2006, 8:53 PM   #1
bulio
Hobbyist Programmer
 
bulio's Avatar
 
Join Date: Jul 2004
Location: Location
Posts: 138
Rep Power: 5 bulio is on a distinguished road
Python shell help

Hi everyone,

For the fun of it, I am trying to write a shell program similar to Linux's bash or Windows' command. I'm writing the program on Windows, and this is what I have so far:

import os

os.chdir('/') #Change the directory to Windows root

while True:
    directory = os.path.abspath(os.curdir) 
    directory += '>>'
    prompt = raw_input(directory) #Print the command line prompt as C:\>>

So far, it waits for the user's input by looping C:\>>.

My next step is to actually make the shell respond to user commands. For example, if the user inputs put "Text here" the shell will interpret the statement as print "Text here".

I think the best thing to use is a parser or string methods. The problem is that I haven't found many docs on either item, and am not sure how to implement this. Does anyone here have a tutorial or an example on how I would parse text so that python can interpret it and do what I want? (I also want to do things such as change directory with a command like dir <dir here> and so on.)

Thanks
bulio is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[tutorial] Python for programming beginners coldDeath Python 30 Dec 14th, 2005 11:35 AM
Convert Python script to C++ code clanotheduck Python 17 Sep 25th, 2005 8:55 AM
Advanced Python Tricks Arevos Python 19 Sep 24th, 2005 7:39 AM
Hybrid python shell Arevos Existing Project Development 0 Sep 22nd, 2005 4:37 PM
Python - A Programmers Introduction coldDeath Python 17 Aug 19th, 2005 12:41 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:08 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC