If I have the script "script1.sh" and I want to make it print its own PID as a first step. How can I do this in bash?
The PID of the currently running script is
$$) Expands to the process ID of the shell. In a
()subshell, it expands to the process ID of the invoking shell, not the subshell.