From:   Chet Ramey
Subject: Re: [bug #68131] Shell script misbehaves when edited
Date:   Mon, 9 Mar 2026 10:26:56 -0400

>On 3/9/26 3:36 AM, Felix Hauri via Bug reports for the GNU Bourne Again SHell 
>wrote:

>But as Greg said,

>It's a well-known pitfall, in any case.

>It's not a `pitfall', simply an invalid assumption.

It sounds like you are interpreting 'pitfall' as 'bug' and, thus, as a
smear against bash.

I say it *is* a 'pitfall', where that word is interpreted as
"something to be on the lookout for; something to be aware of".  Which
is not the same thing as a 'bug'.

It certainly *could* have been implemented in a way where this would
not happen.  There *are* scripting languages that read in the entire
source at startup and build an internal representation which is then
executed.  These languages then don't care if you mess with the source
while the script is running.  But anyone who is familiar (to any
degree) with how bash (and most other Unix shells) is implemented,
will know that bash (and most other Unix shells) is not in this
category.

I think, IIRC, that the "Oil Shell" (Google it) *is* in this category.

Parsing this way (on the fly) does seem kinda clunky in this modern
day and age, but of course, it is what it is.

Finally, as I said in my previous post, I've never actually had
anything bad happen as a result of doing this, so I'm still curious to
see an actual, working example.

=================================================================================
Please do not send me replies to my posts on the list.
I always read the replies via the web archive, so CC'ing to me is unnecessary.

When responding to my posts, please try to refrain from giving bureaucratic 
answers.
If you have nothing useful to say, then just click Next and go on.

Reply via email to