[ale] Quick script question
Danny Cox
danscox at mindspring.com
Mon Mar 3 22:59:41 EST 2003
Douglas,
On Mon, 2003-03-03 at 21:59, Douglas Bridges wrote:
> I am trying to write a script to do something simple, but I have run across a
> little problem. My script is trying to fire off a program with many
> permutations of parameters. When it receives a valid parameter, it fires up a
> GUI. When it gets an invalid parameter, it errors out returning an error
> code ($? = 1). How can I check to see if the GUI was fired up in a bash
> script so that I can automatically try all of these different parameters.
> The GUI fires up within 2 seconds, so if I don't get an error code within
> that time, I can kill the process and assume it worked.
How about:
$ARGS="some args"
while : # always true
do
gui_start_proggy $ARGS &
PID=$!
sleep 3 # sleep 2 may only get you 1.1 secs
if [ -d /proc/$PID ]
then
exit # GUI started
else
wait $PID # reap the child
ARGS=$(permute $ARGS)
fi
done
or something like that. ;-)
--
kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.
Danny
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list