BASH

akonstam at trinity.edu akonstam at trinity.edu
Sat Dec 4 22:41:34 UTC 2004


On Sat, Dec 04, 2004 at 09:50:21AM -0600, Bill Gradwohl wrote:
> Two questions:
> 
> 1) When a BASH script is executed, the file that represents the script 
> must be read by the interpreter. Assuming the script is a long running 
> script, is it safe to modify the script while its executing? The real 
> question boils down to is the entire script read into memory or not 
> before execution starts, or is it read as needed from disk. I ask 
> because I'd like to test a script, and while its running and I see 
> errors, I'd like to modify the script without disturbing the executing 
> version.
As other people have told you the whole script is read in before
execution begins.
> 
> 2) There seems to be no way to "goto" in BASH. If one has a lengthy 
> script that fails half way down, the only thing to do appears to be to 
> wrap the top half in an if that won't execute so as to skip that top 
> half and get to where the script should again restart. Is there a better 
> way to do this?
Back in 1968 Edsger Dijkstra published a note in the Communications of
the ACM, "GOTOs considered harmful".
Since then programming language people have been well agreed that not
only is the "goto" unnecessary in a programming language, it should
never be used if the code is structured (or in other words easily
deciphered). In other words the method you outlined above is the best
way to construct a program.

-- 

=======================================================================
Why not have an old-fashioned Christmas for your family this year? Just
picture the scene in your living room on Christmas morning as your children
open their old-fashioned presents.

Your 11-year-old son: "What the heck is this?"

You:	"A spinning top!  You spin it around, and then eventually it falls
down.  What fun!  Ha, ha!"

Son:	"Is this a joke?  Jason Thompson's parents got him a computer with 
two disk drives and 128 kilobytes of random-access memory, and I get this 
cretin TOP?"

Your 8-year-old daughter: "You think that's bad?  Look at this."

You:	"It's figgy pudding!  What a treat!"

Daughter: "It looks like goat barf."
		-- Dave Barry, "Simple, Homespun Gifts"
-------------------------------------------
Aaron Konstam
Computer Science
Trinity University
One Trinity Place.
San Antonio, TX 78212-7200

telephone: (210)-999-7484
email:akonstam at trinity.edu




More information about the fedora-list mailing list