[TUHS] What was your "Aha, Unix!" moment?

Sean Dwyer ewe2 at ewe2.ninja
Tue Oct 22 16:29:44 AEST 2019


On Mon, Oct 21, 2019 at 12:37:20PM +1000, Warren Toomey wrote:
> On Sun, Oct 20, 2019 at 07:31:55PM -0700, Ken Thompson via TUHS wrote:
> > i was writing the small utilities for the first
> > pdp-11 unix. (rm ls date ....)
> > 
> > so, cd was next.
> > 
> > % pwd
> > /usr/ken
> > % cd /tmp
> > % pwd
> > /usr/ken
> > 
> > Aha!
> 
> As in, 'cd' has to be built into the shell. If it's external, the forked
> child gets to change directory and the parent shell doesn't. I'm just
> putting this in for those who didn't spot the nuance immediately -- took
> me a few tens of seconds.
> 
> But wasn't "chdir" built into the PDP-7 Unix shell?
> 
> Thanks, Warren

Aha indeed, Ken & Warren! 

chdir seems to be a syscall in 7 (sys4.c), its handling in sh mostly in xec.c,
a real workout for the preprocessor ;)

-- 
I love deadlines. I love the whooshing noise as they fly by.


More information about the TUHS mailing list