Operating System - Linux
1753485 Members
4576 Online
108794 Solutions
New Discussion юеВ

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 2
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
Karthik_sg
Frequent Advisor

Re: infi pon pid in shell script

I have found a solution to this question by myself