3 ms·
A tangible example: if you've got a script the likes of: #!/bin/bash echo 'Hi!' sleep 20 echo 'Hello!' ... and runt it ... and while the scr
by mfontani 6y ago
A tangible example:
if you've got a script the likes of:
#!/bin/bash
echo 'Hi!'
sleep 20
echo 'Hello!'
... and runt it
... and while the script is executing the sleep line, modify it so that instead of 'echo "Hello!"' it does something else, like 'echo "Oops!"'...
... once it resumes from the sleep, it'll execute the updated code.
Don't ask me how I know... I just wish it were more well-known.
Don't modify shell scripts while they're running!
- pkulak 6y agoThat is amazing. Bash doesn't even load the script into memory? It just keeps a line pointer and chunks through the open file? There's something comforting about that. :D
- CodesInChaos 6y agoI think batch files do a linear scan for the target label every time the goto is executed.