bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash does not read up the whole script which it is currently executi


From: John Reiser
Subject: Re: Bash does not read up the whole script which it is currently executing
Date: Tue, 04 Aug 2009 08:23:16 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2

On 08/04/2009 12:48 AM, famzah@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.

--




reply via email to

[Prev in Thread] Current Thread [Next in Thread]