[ale] pidof command, how to get shell script running pid

Tim Watts tim at cliftonfarm.org
Fri Aug 20 21:35:46 EDT 2010


Your main problem is you're "sourcing" the script not running it as a
separate process. Omit the first '.' and pidof should work fine.

Another alternative to consider:

Run it like this: ./p.sh >/dev/null &
Now type: echo $!
(No need for a 2nd window)


On Fri, 2010-08-20 at 18:08 -0400, Narahari 'n' Savitha wrote:
> Friends :
> 
> Here is may first sample code
> 
> To keep a script running for ever
>         #!/bin/bash
>         find /
>         find /
>         find /
>         find /
>         find /
>         
> 
> Then go to command line and typ
> 
> . ./p.sh to start the process
> 
> 
> After that in a sep window
> 
> type
> 
> pidof p.sh
> 
> I expect to see a number, instead I see blank.
> 
> any idea how to get the pid of a .sh command running.
> 
> -Narahari 
> 
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo

________
Be not ashamed of mistakes and thus make them crimes.
-- Confucius


________
Facts are stubborn things, but statistics are more pliable.
-- Mark Twain




More information about the Ale mailing list