[NTLUG:Discuss] PID of program started from bash?
Kevin Brannen
kbrannen at pwhome.com
Tue Oct 12 20:24:38 CDT 2004
Jack Snodgrass wrote:
>how do you get the PID of a program that you start from a bash script?
>
>i.e. I do something like
>#!/bin/bash
>/usr/sbin/fingerd &
>#what do you set what to do be the pid of the new fingered server?
>echo $what
>
>
>
echo $!
From the man page:
Special Parameters
The shell treats several parameters specially. These
parameters may only be referenced; assignment to them is
not allowed.
! Expands to the process ID of the most recently exe-
cuted background (asynchronous) command.
More information about the Discuss
mailing list