[Gloucs] shell script

Will Roe gloucs at mailman.lug.org.uk
Fri Dec 20 00:08:01 2002


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

Yo!

On Thu, Dec 19, 2002 at 11:56:11PM +0000 or thereabouts, Mick Brooks wrote:
> On Thu, Dec 19, 2002 at 11:23:15PM +0000, Will Roe wrote:
> > On Thu, Dec 19, 2002 at 11:03:34PM +0000 or thereabouts, Guy Edwards wr=
ote:
>=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
>=20
> Ugh! I don't know bash scripting, but was playing with Guy's code. I can't
> believe that [$opens -lt 5] !=3D [ $opens =3Dlt 5 ] ! Thank Larry Wall fo=
r Perl.
> I'd gotten used to whitespace not mattering...
>=20

No. Bad. Perl not good. Thank the lord for Python so I don't need to learn =
perl

> > >         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
>=20
> Doesn't $$ contain the PID of the script? You probably want to stick your
> process in the background (as Will says) and use $!.

I think you're right, I was just syntax checking, not lexical (or whatever).
I can't be bothered for another `man bash` right now ;)

Good night....
Donk! ZZZZZZZZzzzzzzzzzzzzz

Will
>=20
> Have fun,
>=20
> --=20
> Mick Brooks
> michael.brooks@physics.ox.ac.uk
>=20
> _______________________________________________
> gloucs mailing list
> gloucs@mailman.lug.org.uk
> http://mailman.lug.org.uk/mailman/listinfo/gloucs

--=20
Soap and education are not as sudden as a massacre, but they are more
deadly in the long run.
		-- Mark Twain

--/9DWx/yDrRhgMJTb
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQE+Al7/nDChyePHZXkRAj8EAJ9q/2DdYjtTgYkpQjAcc1Ifk5JMaACdGyJ1
NI7evsNyfSVqT5c1e1lDo9M=
=Ll6q
-----END PGP SIGNATURE-----

--/9DWx/yDrRhgMJTb--