adb: Find PID from the adb shell
Not sure if you can get the PID directly however you can try the following
set `ps |grep android.process.acore` echo $2
This has the affect of setting the output of the ps command into variables $1, $2, $3 etc. The PID value is in $2
Android versions starting with 6.0 already include pidof
utility:
usage: pidof [-s] [-o omitpid[,omitpid...]] [NAME]...
Print the PIDs of all processes with the given names.
-s single shot, only return one pid.
-o omit PID(s)