Rudy’s OBTF Rudolf Adamkovič

Home / Unix / Bash / Grouping commands / Subshell (...)


Gotcha with $$

In a subshell, $$ expands to the PID of the parent shell.

echo $$ && ( echo $$; echo $$; )
53011
53011
53011

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.