3 ms·
The classic for me of an exposition of writing a shell is Advanced UNIX Programming by Marc Rochkind (Bell labs guy and author of SCCS) (not to be confused with
by emmelaich 10y ago
The classic for me of an exposition of writing a shell is Advanced UNIX Programming by Marc Rochkind (Bell labs guy and author of SCCS) (not to be confused with W Richard Steven's text which is also excellent)
http://basepath.com/aup/ http://basepath.com/aup/
First published in 1985; for me ranks up there with K&R The C Programming Language and K&P The UNIX Programming Environment.
- chubot 10y agoWhere does it talk about writing a shell? As far as I can tell, it's about using the kernel programming interface, which is of course very relevant to writing a shell. But I don't see anything about the shell specifically here: http://basepath.com/aup/toc.htm http://basepath.com/aup/toc.htm
- emmelaich 10y agoStarting from section 5.4, Implementing a shell, version 1 As it suggests, he adds features to the shell as he introduces the system calls needed. You can see the source here http://basepath.com/aup/ex/group__AUP2ex.html#Chap http://basepath.com/aup/ex/group__AUP2ex.html#Chap. 5 See files sh0.c (for versions 1 2 3) and sh3.c for version 4.
- chubot 10y agoYes this looks nice. xv6 has a tiny shell as well: https://pdos.csail.mit.edu/6.828/2016/xv6.html https://pdos.csail.mit.edu/6.828/2016/xv6.html