I am executing sshd in a bash script using
sshd will typically write a PID file; by default this is at
/var/run/sshd.pid. You can use this to find the process ID of the listening
sshd process. You should be aware that
sshd may fork several subprocesses as it works, so what you want really depends on what you intend to do with it.