On 08/04/2009 12:48 AM, fam...@icdsoft.com wrote:
First I would like to say that I'm not sure if this is a bug or a feature of Bash. If it is a feature, please let me know how to turn it off; or better make it disabled by default... The problem is that Bash does not read up the whole script which it is currently executing. As a result of this, if we update the script file with a newer version while it is running, this may lead to unpredicted results.
It is an intended design feature that the shell reads only as much as necessary to proceed at the moment. This is required so that subprocesses can share the same stdin as the shell. Bytes for input to the shell alternate with bytes for input to each subprocess that does not have redirection (or closure) specified for its stdin. To avoid this feature, then use the "-c" parameter to specify the entire shell input as a string on the command line: bash -c "$(< filename)" Or, make a temporary unique copy of the file, then invoke the shell on the copy. --