[comp.unix.wizards] How to write a Unix Shell?

toma@ozdaltx.UUCP (Tom Armistead) (08/27/90)

Does anyone know where I can find any information on how to write a Unix
command shell (like sh or ksh)?

I have access to ksh and bash source, but don't want to spend the rest of
my life trying to figure those out.

I would like to find out how the environment space is handled. What, if
anything, needs to be done to siatisfy the kernel and/or the C library
functions like getenv(), putenv() and popen(). And probally a few million
other things that I haven't thought of.

Just to answer any "How come?" questions. "I don't have any real reasons,
just thought it might be fun..."

Any help would be greatly appreciated!!!

Tom
-- 
-------------------------------
{uunet,smu,ames}!sulaco!ozdaltx!toma      (Tom Armistead @ Garland, Texas)
{mic,void,egsner}!ozdaltx!toma

brister@decwrl.dec.com (James Brister) (08/27/90)

On 27 Aug 90 02:24:03 GMT,
toma@ozdaltx.UUCP (Tom Armistead) said:

> Does anyone know where I can find any information on how to write a Unix
> command shell (like sh or ksh)?

Take a look at "Advanced Unix Programming" by Marc Rochkind. He does
exactly this.

James
--
James Brister                                           brister@decwrl.dec.com
DEC Western Software Lab., Palo Alto, California.       .....!decwrl!brister

news@macuni.mqcc.mq.oz (USENET News System) (08/28/90)

In article <6909@ozdaltx.UUCP> toma@ozdaltx.UUCP (Tom Armistead) writes:
>
>Does anyone know where I can find any information on how to write a Unix
>command shell (like sh or ksh)?

There isn't any really good information around on this sort of stuff (I mean
specifically for writing shells), not that I can find anyway. You can
find interesting concepts in "Advanced UNIX programming" by Marc Rochind.
There is a whole section in there on how to write a simple UNIX shell.

>I have access to ksh and bash source, but don't want to spend the rest of
>my life trying to figure those out.

Yup!

>I would like to find out how the environment space is handled. What, if
>anything, needs to be done to siatisfy the kernel and/or the C library
>functions like getenv(), putenv() and popen(). And probally a few million
>other things that I haven't thought of.

The best thing is to go through the UNIX manuals (man 2 intro etc.) and
just find out what you can.

I have had a long interest in UNIX shells, and have implemented some simple
ones myself. What sort of a shell are you trying to put together?


				Regards,
					Martin.

Martin Foord		|	AARNET: martin@macadam.mqcs.mq.oz.au
Systems Administrator	|	UUCP:	...!uunet!macadam.mqcs.mq.oz.au!martin
Macquarie University	|	Computing Science
Australia		|	(02) 805 8940

bernie@DIALix.UUCP (Bernd Felsche) (08/28/90)

In article <6909@ozdaltx.UUCP> toma@ozdaltx.UUCP (Tom Armistead) writes:
>
>Does anyone know where I can find any information on how to write a Unix
>command shell (like sh or ksh)?
>
A useful shell design is discussed in "Advanced UNIX Programming" by
Marc Rochkind (Prentice Hall, Inc.) ISBN 0-13-011818-4 and ISBN
0-13-011800-1 {PBK.} 01

[rest of article deleted]

bernie