Getting PID of process in Shell Script
It's very straight forward. ABCD should be replaced by your process name.
#!/bin/bashprocessId=$(ps -ef | grep 'ABCD' | grep -v 'grep' | awk '{ printf $2 }')echo $processId
Sometimes you need to replace ABCD by software name. Example - if you run a java program like java -jar TestJar.jar &
then you need to replace ABCD by TestJar.jar.