I\'m a bash scripting beginner, and I have a \"homework\" to do. I figured most of the stuff out but there is a part which says that I have to echo the pid of the parent bas
It'd be best to get well-acquainted with bash(1)
:
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.
[...]
BASH_SUBSHELL
Incremented by one each time a subshell or subshell
environment is spawned. The initial value is 0.
$BASHPID
was introduced with bash-4.0-alpha. If you run bash --version
you can find out what version of bash(1)
you're using.
If you're going to be doing much bash(1)
work, you'll also need the following: