Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

infi pon pid in shell script

Karthik_sg
Frequent Advisor

infi pon pid in shell script

ps ux | awk '/runmojo/ && !/awk/ {print $2}'

i want to store the above in a variablesay for ex:
a=ps ux | awk '/runmojo/ && !/awk/ {print $2}'

but thn when i print $a it gives an empty string.Can u help me on this pls
2 REPLIES
Hemmetter
Esteemed Contributor

Re: infi pon pid in shell script

Hi,

try
# a=$(a=ps ux | awk '/runmojo/ && !/awk/ {print $2}')

or

# a=$(ps -C runmojo -o pid)


rgds
HGH
Highlighted
Karthik_sg
Frequent Advisor

Re: infi pon pid in shell script

I have found a solution to this question by myself