Q:

get pid of process - linux

I try to launch an app within it's path and get it's process id:
(cd /opt/server/TrackServer/release && ./TrackServer&) && echo $!

but I always get wrong PID.
Ie i get:
$ (cd /opt/server/TrackServer/release && ./TrackServer&) && echo $!
5078
$ ps aux | grep TrackServer
user    5250  0.6  0.0 153340  7824 pts/0    S    20:09   0:00 ./TrackServer
user    5253  0.0  0.0  14868   976 pts/0    S+   20:09   0:00 grep --color=auto TrackServer

how can I invoke the process within its path and get it's pid?

A:

If there's only one running, an easy way to do it is with pidof TrackServer

