[Techtalk] shell scripting
Laurel Fan
laurel at sdf.lonestar.org
Mon Feb 10 15:26:41 EST 2003
On Mon, Feb 10, 2003 at 04:51:24PM -0500, Emma Jane Hogbin wrote:
> The problem is I need each line to run only after the previous line has
> finished. I thought that it would do that automagically, but it doesn't
> seem to work that way and I get two instances of htdig going at the same
> time and everything falls apart.
>
> How do I say (in the shell script), "don't start until it's your turn"?
Your first impression was correct. Usually, putting several commands
in a shell script like that will run them sequentially. For example,
if you have a shell script like this:
sleep 5
echo foo
sleep 5
echo bar
it should wait 5 seconds, say "foo", wait another 5 seconds, and say
"bar". It works this way because:
1. The command sleep will run for 5 seconds, then exit.
2. The shell waits for sleep to exit before going on to the next
command.
So, two things could be going wrong:
1. htdig, etc. does not act like sleep; ie. it exits before it's done
(runs in the background)
2. The shell is being weird.
I would guess that #1 (or neither) is more likely than #2.
To test #1, run htdig from a prompt, and see if you get your prompt
back immediately, or when it's done.
To test #2, run the sleep/echo shell script above and see if it acts
like I thinkt it should.
--
laurel at sdf.lonestar.org
http://dreadnought.gorgorg.org
More information about the Techtalk
mailing list