variable

Bash BASHPID — current Bash process ID

Expands to the process ID of the current Bash process. It can differ from $$ in a parenthesized subshell.

Formal Syntax & Structure

bash syntaxbash
$BASHPID

Return Value

integer text

Current Bash process identifier.

Working Example

Example Snippetbash
printf 'outer: %s %s\n' "$$" "$BASHPID"( printf 'inner: %s %s\n' "$$" "$BASHPID" )
Bash Reference