1.the command line interpreter checks whether the input command line matches a pre-defined lanaguage or not..If yes the os shell checks and invokes the programs specified in the input command line..else wait command line..
2.process creation..
Find the programs..with absolute path or relative path
3.i/o redirection
Rule [command name][arg]*<[filename]
4. detecing process termination and susupension.
5. signal handling.. such as Ctrl+Z and Ctrl+C
that are some problems..i cant solve it... finding help plz..>.< can some one gives me some hints..or some pseduo code...or lay out..i am stumming on it.now
Building a Shell in C finding help plz
Started by lhy990084, Oct 04 2008 09:13 PM
7 replies to this topic
#1
Posted 04 October 2008 - 09:13 PM
|
|
|
#2
Posted 04 October 2008 - 10:53 PM
This sounds a lot like homework. Try to come up with a plan, and at least show us that. Pseudocode isn't really that difficult to come up with. What OS are you compiling for?
#3
Posted 05 October 2008 - 03:50 AM
dargueta said:
This sounds a lot like homework. Try to come up with a plan, and at least show us that. Pseudocode isn't really that difficult to come up with. What OS are you compiling for?
Sounds like a Unix.
Best option is to look up the POSIX system calls.
#4
Posted 05 October 2008 - 05:26 AM
Another question is: what commands will you support? Will you be displaying error messages?
It looks like you haven't fully posted your instructions, either. For example, while this is a definition of a shell, it doesn't indicate whether you must create a shell, write a paper on those aspects of a shell, or something else.
It looks like you haven't fully posted your instructions, either. For example, while this is a definition of a shell, it doesn't indicate whether you must create a shell, write a paper on those aspects of a shell, or something else.
#5
Posted 05 October 2008 - 07:40 AM
yes it is on UniX.. i dont how to write.. (when user typing some command which is correct or not..if correct the process creation.. it give some tips for me .. (use fork system call and exec system call..) but i have type many time..i cant do it..
#6
Posted 05 October 2008 - 01:30 PM
So you don't know what commands you're going to support? Come up with a list of the ones you use most often, and support those. Pick maybe 10 at most to begin with.
#7
Posted 06 October 2008 - 08:07 AM
Basically: you have to
1) accept a string
2) be able to parse the string to determine what should be done
3) determine if any of the involved commands return an error (does not exist or fails on the input)
I would start with something simple, like supporting basic commands such as ls, mv, etc.
1) accept a string
2) be able to parse the string to determine what should be done
3) determine if any of the involved commands return an error (does not exist or fails on the input)
I would start with something simple, like supporting basic commands such as ls, mv, etc.
#8
Posted 06 October 2008 - 08:25 AM
The way to actually do that is to fork(), and then in one process, execl() another program.


Sign In
Create Account

Back to top









