4 ms·
Something that I particularly hate with shell scripting is that if you modify a shell script while it is executing, it will break the running instance: bash doe
by hules 5y ago
Something that I particularly hate with shell scripting is that if you modify a shell script while it is executing, it will break the running instance: bash does not load the whole script on startup, it reads it line after line while executing it. I wonder why this stupid and dangerous behavior has never been changed.
- caymanjim 5y agoThis is not true. I'm not sure what you're seeing, but neither bash nor zsh behave like this in Linux or MacOS.
- effie 5y agoGP is correct. Bash does not read and parse whole script on start, that would be slow. It is done when needed.
- ptspts 5y agoWrap the script with:if :; ...; fi; exit