I'm reading BASH pocket guide of Oreilly.It said: The process ID of the current Bash process.  In some cases, this can differ from $$.Above explanation , explained $BASHPID variable.Question: which cases?
$BASHPID And $$ differ in some cases
bash;shell;process;parameter;subshell
An example is provided in the BASHPID description of the bash manpage:   BASHPID          Expands to the process id of the  current  bash  process.   This          differs  from  $$ under certain circumstances, such as subshells          that do not require bash to be re-initialized.Here is an example of a subshell outputting the contents of the variable, along with $$ and the contents of BASHPID outside of the subshell.$ echo $(echo $BASHPID $$) $$ $BASHPID25680 16920 16920 16920  |     |     |     |  |     |     |     -- $BASHPID outside of the subshell  |     |     -- $$ outside of the subshell  |     -- $$ inside of the subshell  -- $BASHPID inside of the subshell