Currently, whenever I change a hand-written script on my system, all running usages of the script are prone to errors.As far as I understand it, bash (other shells too?) read the script incrementally, so if you modified the script file externally, it starts reading the wrong stuff. Is there any way to prevent it?UPDATE. For example, consider this script:sleep 20echo testIf I execute the script, bash will read the first line (say 10 bytes) and go to sleep. When it resumes, there can be different contents in the script starting at 10-th byte. I may be in the middle of a line in the new script. Thus the original script will be broken.
How to read the whole shell script before executing it?
shell