In my Bash shell the $$ variable expands to the process ID of the shell.
So why does ps print its own name when I execute this?
$ bash -c 'ps -p $$ -o comm='
ps
When I follow it with a no-op command, ps does print the name of the shell.
$ bash -c 'ps -p $$ -o comm= && true'
bash
Versions:
- GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
- ps from procps-ng 3.3.16