[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Editing a running bash script can cause it fail?
From: |
Chet Ramey |
Subject: |
Re: [Help-bash] Editing a running bash script can cause it fail? |
Date: |
Tue, 28 May 2013 15:27:15 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 |
On 5/26/13 10:59 PM, Chris Down wrote:
> I'm not totally sure how it happens or what the conditions for re-reading
> the script are, but it is known[1].
>
> PS (to Chet, et al): is this documented in detail somewhere? This seems
> like one of the few things that I've not been able to find functional
> documentation on, whether in the bash manuals, or elsewhere.
It's not. It's simply an implementation detail.
If you're interested, the code bash uses to read script files is in
input.c. Bash reads script files in 8K chunks, but seeks backward when
forking children to set the file pointer to where the parser has read,
so children don't see read-ahead. When reading a script from the standard
input, this is required.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/