Hello All,
I have a problem in counting number of process getting run with my current script name..
Here it is
This display just one line with the PID, PPID and other details when i print it in the script.
But when I want to count the numbers in my script , just like below, it comes out as 2... Whereas only one process is running..
My mind completely gone blank, help me here..
Help me how I will get my script to print the correct number of Process running with its name. Thanks.
I have a problem in counting number of process getting run with my current script name..
Here it is
Code:
ps -ef | grep $0 | grep -v grep
But when I want to count the numbers in my script , just like below, it comes out as 2... Whereas only one process is running..
Code:
count=$(ps -ef | grep $0 | grep -v grep | wc -l)
echo $count
Help me how I will get my script to print the correct number of Process running with its name. Thanks.