I have trying to get pid of a process using "set --" as following:
say a process is started with command: java -jar someProg.jar
In a shell script, i can get the processId using this way:
#
pid_=$(ps -axf | grep someProg | grep -v grep)
set -- $pid_
echo $1
#
Now , I tried to get pid on terminal by writing command as:
ps -axf | grep someProg | grep -v grep | set -- | echo $1
But I didn't get anything.
How can i get the output pid using set -- command on terminal.
Thanks
What about
ps -axf | grep someProg | grep -v grep | awk '{print $1}'
It shows PID of someProg
process...