Re: infi pon pid in shell script (142 Views)
Reply
Frequent Advisor
Posts: 68
Registered: ‎04-18-2007
Message 1 of 3 (142 Views)

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
Esteemed Contributor
Posts: 284
Registered: ‎10-17-2000
Message 2 of 3 (142 Views)

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
Frequent Advisor
Posts: 68
Registered: ‎04-18-2007
Message 3 of 3 (142 Views)

Re: infi pon pid in shell script

I have found a solution to this question by myself
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.