3 ms·
That's the way current shells work. They do actually use buffered input, but they use lseek on the input so each time they always read the next command from th
by rwmj 3y ago
That's the way current shells work. They do actually use buffered input, but they use lseek on the input so each time they always read the next command from the file.
You can prove this fairly easily:
$ cat input.sh
echo hello
sleep 10
echo world
During the sleep, edit input.sh and change "world" to something else. It will print the something else.
It should be possible to implement goto etc as external commands, although of course somewhat inefficient and unnecessary.