[Gloucs] shell script

Guy Edwards gloucs at mailman.lug.org.uk
Thu Dec 19 23:09:59 2002


Hi,

I've got the following shell script I've cobbled together, it's not
working though.

I want to open and close a program a number of times (I've used ls as an
example here but it's a bigger program)

-----------------

#!/bin/bash

opens="0"			// set the value of opens to 0

echo "Starting run"

while ($opens < 5); do		// while opens is less than 5 do....
        ls			// command name
        $$=$current		// store its process ID
	sleep 10		// give program time to finish starting
        kill $current		// kill the process 
        opens=$opens+1		// add one to the number of opens
	echo "\nOpened program $opens times" 	// give feedback
done

return 0

-------------

Could anyone point me in roughly the right direction?

Guy