Self-editing scripts 📜
Thrig suggests that I was wrong about shell scripts being read in their entirety at start up
...and talks about tracing and IO in a convincing way, and it sounds like I'd got it wrong. So I experimented.
testedit.sh
Output
The script was modified on disk while running, but it wasn't re-read. Only if I run it a second time do I get a surprise.
Have I misunderstood something?
Batch version
Output
This time there's a surprise. After sed exited, the batch file was re-read.