4 ms·
The most important thing for understanding shell (without loads of special cases) is understanding the Unix kernel, as well as the kernel interface that the she
by chubot 6y ago
The most important thing for understanding shell (without loads of special cases) is understanding the Unix kernel, as well as the kernel interface that the shell uses (i.e. which syscalls).
If you strace the shell, that goes a long way. If you haven't used strace or don't know what it is, I recommend learning.
These comics give more details, and so do Julia Evan's other comics (I think the first one was about strace):
Three Comics For Understanding Unix Shell
http://www.oilshell.org/blog/2020/04/comics.html http://www.oilshell.org/blog/2020/04/comics.html
For example this will help you understand that filenames and argv arrays are byte strings in Unix, which may be different than the notion of strings in your programming language.
-----
That will go a long way. However there is still a ton of accidental and needless complexity in bash, particularly related to string processing, and which is unrelated to the kernel. Hence the Oil project:
http://www.oilshell.org/blog/2020/01/simplest-explanation.html http://www.oilshell.org/blog/2020/01/simplest-explanation.ht...