Shell Implementation


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Shell Implementation
# 1  
Old 10-02-2001
Question Shell Implementation

I want to implement my own simple multi tasking shell in Unix which will take care of redirection (<, >, >>) and piping.
I am just unable to get a concrete idea of how exactly I have to start. I have several books...some are..

1. Maurice Bach- Design Of Unix Operating System
2. Richard Stevens- Advanced Programming in Unix

However I find the language too high and complicated in these books.

Can someone please suggest how exactly I should go abt it...(step by step)

What are the things that I need to Learn to Implement this?
(anything and everything)


Smilie Smilie
# 2  
Old 10-02-2001
Based on the GREAT books you mention, I gather you
are thinking about using C... yes?

IMHO an excellent choice. However, if you are new to C,
those books may be more confusing than helpful.

I would suggest a "friendlier" book. There are so many
books out there I would be hard pressed to recommend
any particular one. You may want to search through the FAQs
on this forum for some book titles.

If C is not your cup of tea... you can also use perl.

Anyway, sounds like a great learning project and with those
books, you are on the right track. Smilie
# 3  
Old 10-02-2001
Thanks rwb1959.......but thats not what exactly that I wanted....
A more detailed guidance would be really helpful for me...
# 4  
Old 10-02-2001

In general, you want to write a program that take "line" input
(i.e. gets() ) and parses it looking for "special" characters
(don't forget to process escape "\" characters as well). From
that point, you can use fork() exec() to actually run the commands
and use popen() to facilitate redirection to/from parent and
children processes.

I hope this gives you an idea of where to start. Note that in
at least one C programming book (I don't remember which),
they actually give you a rudimentary shell as a programming
example.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

C: CSV implementation

I have this code from a programming book: #include <stdio.h> #include <string.h> char buf; /* input line buffer */ char* field; /* fields */ char* unquote( char* ); /* csvgetline: read and parse line, return field count */ /* sample input:... (3 Replies)
Discussion started by: totoro125
3 Replies

2. UNIX for Advanced & Expert Users

Ipsec implementation

How can i implement Ipsec between two machines in linux_ ubuntu? any link?? suggestion?? (0 Replies)
Discussion started by: elinaz
0 Replies

3. Linux

Shell implementation - Command not found

Hi, I am trying to execute a program with pipes to run a few basic commands by forking children. When I try to run commands in the child process without pipe, I am unable to run the command as execv fails. However for commands that are given with pipes execute successfully. for example:... (1 Reply)
Discussion started by: mmurali2
1 Replies

4. UNIX for Dummies Questions & Answers

Lseek implementation

Hi everybody, i've been googling for ages now and gotten kinda desperate... The question, however, might be rather trivial for the experts: What is it exactly, i.e. physically, the POSIX function (for a file) "lseek" does? Does it trigger some kind of synchronization on disk? Is it just for the... (4 Replies)
Discussion started by: Humudituu
4 Replies

5. Linux

CAPWAP implementation

Hi I'm trying to implement CAPWAP protocol for my application.i'm able to configure my server side but i'm getting error at client(WTP) side as IOCTL error.while running the command #./WTP /mnt/cf/capwap/ : wlan2 Starting WTP... # WTP Loads... (0 Replies)
Discussion started by: ran789
0 Replies

6. UNIX for Advanced & Expert Users

Malloc Implementation in C

Hey Guys Some of my friends have got together and we are trying to write a basic kernel similar to Linux. I am trying to implement the malloc function in C and I am using a doubly linked list as the primary data structure. I need to allocate memory for this link list (duh...) and I don't feel... (2 Replies)
Discussion started by: rbansal2
2 Replies

7. Programming

Malloc implementation in C

Hey Guys I am trying to implement the malloc function for my OS class and I am having a little trouble with it. I would be really grateful if I could get some hints on this problem. So I am using a doubly-linked list as my data structure and I have to allocate memory for it (duh...). The... (1 Reply)
Discussion started by: Gambit_b
1 Replies

8. Shell Programming and Scripting

Need help on AWK implementation

Hi, I am accepting a string from user. compare this output with the awk output as below... echo "\n\n\tDay : \c" read day awk '{ if($day == $2) { if ($mon == $1) { print "Yes" }}}' syslog.txt I am getting the follwoing error awk: Field $() is not correct. The input line... (5 Replies)
Discussion started by: EmbedUX
5 Replies

9. UNIX for Advanced & Expert Users

Implementation of ls - i command

It is possible for me to obtain the Inode of the path name using ls -i <pathname> command Can anyone tell me how its implemented... (3 Replies)
Discussion started by: ganapathy.psgit
3 Replies

10. Programming

Shell Implementation not working correctly

//save in/out int tmpin = dup(0); int tmpout = dup(1); //set initial input int fdin; if(_inputFile) { fdin = open(_inputFile, O_RDONLY | O_CREAT, S_IREAD | S_IWRITE); } else { //use default input fdin = dup(tmpin); } int ret; int fdout; for(int i = 0; i... (14 Replies)
Discussion started by: AirBronto
14 Replies
Login or Register to Ask a Question