Take care editing bash scripts (2019)
Whether this happens or not depends on how the file is edited, I think.  From the strace output shown in TFA, it appears the file is not opened again between executing the lines.  E.g. using vim as editor, the modified file is actually written as a new file under the same filename.  In Linux, the bash process will keep the original file open so that the inodes are not reclaimed by the filesystem until the file is closed.  Hence the bash process won't "see" the modified script file.I've tested this, and indeed when editing the file with vim, I can't reproduce the "dangerous" behavior.  To trigger this behavior, I'd have to overwrite the script file, e.g. by    1. create script run.sh with "sleep 30" etc
    2. create script run1.sh with "sleep 3" instead
    3. start run.sh
    4. overwrite script: cat run1.sh > run.sh
    5. after the sleep, the commented line does execute

Are there editors that actually overwrite the original file, instead of creating a new file?  I thought the latter is the recommended approach as it can prevent data loss e.g. if there's a crash during writing the file.P.S. If the script in question is on a network file system, things may be different even for vim. E.g. on NFS the file handle doesn't behave fully like a regular POSIX file handle, and the NFS server might actually reopen the file between reads, thus delivering the modified contents to the bash process.