Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 May 2000 15:59:10 -0600
From:      Charles Randall <crandall@matchlogic.com>
To:        Alex Boisvert <boisvert@exoffice.com>, freebsd-questions@freebsd.org
Subject:   RE: PID of a forked process
Message-ID:  <5FE9B713CCCDD311A03400508B8B3013B257E1@bdr-xcln.is.matchlogic.com>

next in thread | raw e-mail | index | archive | help
No offense, but RTFM via "man bash". I believe "$!" is what you're looking
for.

-Charles

-----Original Message-----
From: Alex Boisvert [mailto:boisvert@exoffice.com]
Sent: Monday, May 15, 2000 3:45 PM
To: freebsd-questions@freebsd.org
Subject: PID of a forked process


Hello,

I have a basic BASH-related question.  How does one obtain the PID of a
forked process in bash?

Here's what I'd like to do:

#!/usr/local/bin/bash
while test 1
do
  PID = some_long_process &
  sleep 60
  kill -9 PID
done

I'm going to use this script in a test framework where I need to test an
application for recoverability.  So I want to start the application,
wait for a given amount of time and then kill this application and
repeat.

So how to I obtain the PID of a process which is forked?  I've tried %%
but it didn't work.

regards,
alex.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5FE9B713CCCDD311A03400508B8B3013B257E1>