I use zsh as my shell, and rbenv to manage my Ruby versions. I am diving into rbenv's internals to learn how it works. I type
vim `which bundle`
into my terminal and I see the following code:
1 #!/usr/bin/env bash
2 set -e
...
After the shebang, the first line of code is set -e. Wanting to learn more about set, I type man set into my terminal, but I get:
BUILTIN(1) General Commands Manual
in response. From this I determine that set is a builtin command. From this StackOverflow answer, I interpret that to mean that builtins such as set could be implemented differently depending on which terminal the user is employing (i.e. bash vs zsh vs fish). To quote the answer:
Every Unix shell has at least some builtin commands. These builtin commands are part of the shell, and are implemented as part of the shell's source code... Different shells have different builtins, though there will be a whole lot of overlap in the basic set.
I'm assuming that the set command is part of this "basic set" that the answer refers to, right? That would make the most sense to me, since the authors of rbenv are quite experienced and I would think they're unlikely to rely on a command which could behave differently depending on the user's shell.
My question is two-fold:
If my above assumption is correct, where is that "basic set" of commands defined? Is it some sort of officially-recognized, industry-wide standard that all shells must adhere to? And if so, what is that industry-wide standard known as, so I can Google it and learn more?
If my assumption is wrong, and if the
setterminal command is not part of some broad standard, does that mean that different shells could implementsetin different ways, possibly producing different behavior? And wouldn't it therefore be dangerous for a widely-used program likerbenvto rely on such a command, since it could behave differently on different users' machines?