I found some inconsistent behavior of $BASHPID as below:# On Mac Yosemiteecho $BASH_VERSION ${BASH_VERSINFO[5]} $BASHPID# => 3.2.57(1)-release x86_64-apple-darwin14# On Ubuntuecho $BASH_VERSION ${BASH_VERSINFO[5]} $BASHPID# => 4.3.11(1)-release x86_64-pc-linux-gnu 29134The $BASHPID is not present for Mac OSX, is it not safe to use it to write portable script?
Portability of $BASHPID
bash
The builtin variable $BASHPID was introduced in bash version 4.0.See the file NEWS in the bash source code: 397 ------------------------------------------------------------------------------- 398 This is a terse description of the new features added to bash-4.0 since 399 the release of bash-3.2.  As always, the manual page (doc/bash.1) is 400 the place to look for complete descriptions. 401  402 1.  New Features in Bash 403  ... 410 c.  There is a new variable, $BASHPID, which always returns the process id of 411     the current shell.