5 ms·
> 2. That the shell can "only" do program invocation, such that even its basic primitives like 'cd' and '[' can be just themselves programs. "cd" is one of a f
by chungy 5y ago
> 2. That the shell can "only" do program invocation, such that even its basic primitives like 'cd' and '[' can be just themselves programs.
"cd" is one of a few commands that basically must be built-ins no matter what, since it has to modify the environment of the shell itself. Any external command can only modify its own environment, not the shell's environment.
- zerocrates 5y agoJust have cd spawn you a new shell that's in a new working directory, solved! Call it the immutable shell.
- HideousKojima 5y agoHave it contain a hash of the previous shell and cryptographically verify its authenticity with all of the electricity in Argentina and you can even get the crypto guys to promote it for you for free!
- OJFord 5y agoHa, great idea. Unfortunately for you I just minted a non-fungible token that describes my claim to its representation in digital form, I own that idea. (Of course you might want to mint a different NFT using a slightly different way of digitally representing it, but let's not worry about that. Mine.)
- ahefner 5y agoNow I'm imagining an analogy to continuation passing style: exec (tail call) 'cd', tell it to exec /bin/sh (the continuation) in the modified environment.