[Techtalk] shell scripting

Maria Blackmore mariab at cats.meow.at
Mon Feb 10 23:47:04 EST 2003


Hello

On Mon, 10 Feb 2003, Emma Jane Hogbin wrote:

> I'm trying to write a little shell script that will run a bunch of
> programs in sequence. The script looks something like this:

<snip>

> 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.

ah, not desirable :)

> How do I say (in the shell script), "don't start until it's your turn"?

hmm, normally I would suggest to put them all on one line, and put &&
between them.

&& means "only run the next command if the previous command returned exit
code 0", which in turn gives the effect that you have to wait for it to
finish, because until it finishes you don't have an exit code.

However, something interesting seems to be going on here, does anyone know
if htdig forks into the background?

If you run one of the commands on a command line, by itself, do you get a
shell prompt back straight away?

I realise this probably isn't terribly helpful, but I thought that the
generic advice on how to do this might be useful to someone :)

Maria




More information about the Techtalk mailing list