Hah, hadn't thought of that. Kind of CPS for processes. I'm not sure what that would gain you, though, as you'd have to either a) write both the cd and the user of the cd, and there are less awkward ways to do that than exec'ing, or b) you'd have to pass something ELSE to exec to return control after cd finishes.
This seems a little awkward and I'm not sure what is being proven. :P
Re:Unix Recovery Legend (1986)
by aardvark179 on Thursday September 03, 2015 @03:39AM
(#10163738)
It's how very early version of Unix effectively did stuff, they exceed a program, and when it exited they exceed the shel again.
When they introduced something like the fork/exec model we now have they discovered cd didn't work any more and had to write it as a built in.
Now, for bonus points, work out how goto worked when it wasn't a built in.
Re:Unix Recovery Legend (1986)
by JoshTriplett on Thursday September 03, 2015 @12:01PM
(#10165669)
> It's how very early version of Unix effectively did stuff, they exceed a program, and when it exited they exceed the shel again.
Makes sense, since those systems might not have enough memory to run the shell and another program at the same time.
Re:Unix Recovery Legend (1986)
by acveilleux on Thursday September 03, 2015 @02:24PM
(#10166682)
This would cause an eventual exhaustion of process table entry / pid and/or addressable memory as the previous shell is left in the background.
Sample:
Sample code: