One of my engineering projects involves creating a linux shell.
This is actually creating a shell somewhat like bash, but possibly simplified.
I don't want info on "shell programming", i want info on how to actually design a shell or what functions a shell must handle and how it can communicate with the kernel.
Please suggest some websites/pages.
Comments
:
do any body have the source code of the linux shell?
i am also developing the same.
so it will helpful to me.
Regards Rakesh
bash: http://www.gnu.org/software/bash/ (or http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html)
(this is the most popular shell)
korn: http://www.kornshell.com/
tcsh: http://www.tcsh.org/Welcome
you find a list of available shells by typing "cat /etc/shells" at the command line.
------
nugent
------------------
Internal Commands
cd
pwd
exit
help
dir
clear
history
------------------
External Commands
kill
echo
------------------
Regards
Rakesh
: there is no "linux shell" but there are many shells available for linux including:
:
: bash: http://www.gnu.org/software/bash/ (or http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html)
: (this is the most popular shell)
:
: korn: http://www.kornshell.com/
:
: tcsh: http://www.tcsh.org/Welcome
:
: you find a list of available shells by typing "cat /etc/shells" at the command line.
:
: ------
: nugent
:
:
:
:
if input is equal to "exit" your program quits.
for cd and pwd see: http://www.gnu.org/software/libc/manual/html_node/Working-Directory.html#Working-Directory
for help just print the list of commands and what they do
dir: http://www.gnu.org/software/libc/manual/html_node/Accessing-Directories.html#Accessing-Directories
clear: there are many ways to do this. try to figure it out for yourself first, but if you have problems you know where to ask.
history: this just a list of commands that have been previously executed, so you will either have to store this in memory or in an external file (bash uses ~/.bash_history) and print it to stdout when required.
to run an external command you can use system() or one of the functions from the exec() family (execl, execlp, execle, execv, execvp).
------
nugent
i am still getting problem doing this.if you will send some sample codes for these commands ,it will be very helpful for me.
: an easy way to do this to continually read a line from stdin (use gets, or fgets) and parse the input.
:
: if input is equal to "exit" your program quits.
:
: for cd and pwd see: http://www.gnu.org/software/libc/manual/html_node/Working-Directory.html#Working-Directory
:
: for help just print the list of commands and what they do
:
: dir: http://www.gnu.org/software/libc/manual/html_node/Accessing-Directories.html#Accessing-Directories
:
: clear: there are many ways to do this. try to figure it out for yourself first, but if you have problems you know where to ask.
:
: history: this just a list of commands that have been previously executed, so you will either have to store this in memory or in an external file (bash uses ~/.bash_history) and print it to stdout when required.
:
: to run an external command you can use system() or one of the functions from the exec() family (execl, execlp, execle, execv, execvp).
:
:
:
: ------
: nugent
:
:
:
:
this is a relatively simple thing to do, i have a complete version of what you want, its only about 200 lines of code and took about 15 minutes to write.
I'm guessing that this is some sort of project (for school or college) which is why i am not going to just give you the code, but if you tell where you are having problems, or what exactly you can and cannot do i should be able to help you
------
nugent
thanks in advance.
Rakesh
: this is a relatively simple thing to do, i have a complete version of what you want, its only about 200 lines of code and took about 15 minutes to write.
:
: I'm guessing that this is some sort of project (for school or college) which is why i am not going to just give you the code, but if you tell where you are having problems, or what exactly you can and cannot do i should be able to help you
:
:
:
: ------
: nugent
:
:
:
: