|
|
|
|
|
by jjnoakes
480 days ago
|
|
An article like this would be better if it didn't gloss over the different bash startup files and when they get loaded. Many times when I help someone debug their shell, the root cause is not understanding what each of those files is for. Adding an echo to the wrong one and not having it check if the shell is interactive can break all sorts of things like scp for example. And in weird and non-obvious ways. |
|
The startup files are mostly comprehensible if you understand the following two oddities:
* Some pseudo-terminal programs always start the shell as interactive; other pseudo-terminal programs always start the shell as non-interactive.
* Shells started from SSH are different than all other shells, regardless of interactivity.
* Shells other than bash are broken-by-design and really should not be used if you have any choice, but in the real world you do have to know at least a little about how to deal with their brokenness.
I have a much saner script here: https://gist.github.com/o11c/03a4b321220395b97dadc3f1ca740db...