Hello,
I'm trying to make a script which reads the PID of a process using awk. I've read the thread in this forum where it is explained.
However, the problem i'm having is when attributing that PID value to a variable.
I'm using AIX 5.3.
The command is the following:
:/home/user1>ps -ef | grep xellerate | grep -i java | awk '{ print $2 }'
958598
Which as you can see.. works.
The problem i'm having is when I try to execute a script which is the following:
#!/bin/ksh
pid=""
pid='ps -ef && grep xellerate && grep -i java && awk '{print $2}''
echo $pid
:/home/user1> ./watchdog2
./watchdog2[3]: }: not found.
:/home/ias1013> pid='ps -ef && grep xellerate && grep -i java && awk '{print $2}''
/bin/ksh: }: not found.
AWK is not doing what I want it to.
Does anyone have any ideas why?
Thanks in advance,
Mambo