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

James Sumners james.sumners at gmail.com
Fri Aug 20 18:23:44 EDT 2010


Here is my `p.sh`

==================
#!/bin/bash
while [ 0 -eq 0 ]; do
    continue
done
==================

Now, after executing `p.sh` I can do `ps -eo pid,comm | grep p.sh |
sed -e "s/^\s//" | cut -d" " -f1` to get the pid of the process.

On Fri, Aug 20, 2010 at 6:08 PM, Narahari 'n' Savitha
<savithari at gmail.com> 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
>
>



-- 
James Sumners
http://james.roomfullofmirrors.com/

"All governments suffer a recurring problem: Power attracts
pathological personalities. It is not that power corrupts but that it
is magnetic to the corruptible. Such people have a tendency to become
drunk on violence, a condition to which they are quickly addicted."

Missionaria Protectiva, Text QIV (decto)
CH:D 59


More information about the Ale mailing list