[Gloucs] shell script

Will Roe gloucs at mailman.lug.org.uk
Thu Dec 19 23:33:01 2002


--oJ71EGRlYNjSvfq7
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Although, you do a sleep 10 after the process has finished starting
which is a bit pointless, the command after 'ls' won't be executed
until 'ls' has terminated. You would have to do 'ls &' to detach
that process from the script. This is the sort of thing that a=20
proper scripting language such as python would do much easier ;)

Keep us informed as to if it works (and what the hell it's for)
I assume it's some sort of stress testing??

Have fun,
Will

On Thu, Dec 19, 2002 at 11:23:15PM +0000 or thereabouts, Me wrote:
> Hi,
>=20
> On Thu, Dec 19, 2002 at 11:03:34PM +0000 or thereabouts, Guy Edwards wrot=
e:
> > Hi,
> >=20
> > I've got the following shell script I've cobbled together, it's not
> > working though.
> >=20
> > 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)
> >=20
> > -----------------
> >=20
> > #!/bin/bash
> >=20
> > opens=3D"0"			// set the value of opens to 0
> opens=3D0
> >=20
> > echo "Starting run"
> >=20
> > while ($opens < 5); do		// while opens is less than 5 do....
> while [ $opens -lt 5 ] ; do
> >         ls			// command name
> >         $$=3D$current		// store its process ID
> current=3D$$
> > 	sleep 10		// give program time to finish starting
> >         kill $current		// kill the process=20
> >         opens=3D$opens+1		// add one to the number of opens
>=20
> that should be opens=3D$(($opens+1))
>=20
> > 	echo "\nOpened program $opens times" 	// give feedback
> > done
> >=20
> > return 0
>=20
> If that doesn't work, I'll eat my cat...oh sorry...hat ;)
>=20
> Will
> >=20
> > -------------
> >=20
> > Could anyone point me in roughly the right direction?
> >=20
> > Guy
> >=20
> >=20
> >=20
> > _______________________________________________
> > gloucs mailing list
> > gloucs@mailman.lug.org.uk
> > http://mailman.lug.org.uk/mailman/listinfo/gloucs
>=20
> --=20
> Some people have parts that are so private they themselves have no
> knowledge of them.



--=20
Grandpa Charnock's Law:
	You never really learn to swear until you learn to drive.

	[I thought it was when your kids learned to drive.  Ed.]

--oJ71EGRlYNjSvfq7
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+Ala3nDChyePHZXkRAs2jAKCd3+ImdhWDSL62ctOOzUNGjJclDQCeIwHp
0YhbLkqosEpTWNXmzFxWkWk=
=jHft
-----END PGP SIGNATURE-----

--oJ71EGRlYNjSvfq7--