Variable assignments such as the ones we've done so far in this chapter are only visible to the current running shell. Their values don't implicitly affect a program called by the script – a forked process.
The easiest way to demonstrate this on the command line is to start another shell process after making an assignment. Consider this basic shell session, including an assignment to a variable named realname:
bash$ declare -p BASHPID declare -ir BASHPID="7013" bash$ realname='Bash User' bash$ declare -p realname declare -- realname='Bash User'
If we start a new bash process, we get a new process ID in BASHPID, and the realname variable does not show as a set:
bash$ bash bash$ declare -p BASHPID declare -ir BASHPID="7585" ...