3 ms·
It doesn't happen with the z-shell (zsh) as I just tested under Debian. Bash shows the described behaviour. Interesting, need to look at other shells too, later
by jcynix 6y ago
It doesn't happen with the z-shell (zsh) as I just tested under Debian. Bash shows the described behaviour. Interesting, need to look at other shells too, later.
But it's definitely better to be careful and expect the bash ("classic"?) behaviour.
- sneak 6y agoThat was my next question, thank you. (Just switched to zsh last month after 20+ years on bash.)
- clort 6y agoBear in mind that bash is obviously restarting from the character position specifically but other shells might not handle this at all, meaning that they just use buffered stdin. For such a small script the whole thing has been read into the buffer but a longer script might fault at an otherwise unobvious point. Unless you know that it is explicitly safe (ie the whole file has been cached before it starts) then you should really not modify any running file.