In this case, the problem is in how you deploy the scripts, and not
with bash. Don't change a running script, just write the new script
to a temp file and then replace the script.

That looks something like this:

  mv newscript oldscript

This way, bash will keep reading from oldscript, but new instances of
the script will use newscript instead. That's not just a bash issue,
but a general problem with deployments where you want to avoid
serving inconsistent content (some files updated and some not),
that's why you usually write everything to a location on the same
filesystem, and just issue a mv, which uses rename(2) under the hood.

Note that replacing a file is not the same as editing the file in
place.

So, fix your environment, it's not a bash issue.

-- 
Eduardo Alan Bustamante López

Reply via email to