You are already aware of shell. It is a program that lets you run commands in Linux. Your major interaction with shell is when you are running commands in a terminal. .
Sooner or later you8217ll come across a term called 8216subshell8217 and that may confuse you. .
A subshell is basically a new shell just to run a desired program. A subshell can access the global variables set by the 8216parent shell8217 but not the local variables. Any changes made by a subshell to a global variable is not passed to the parent shell.
Does that make sense Probably not. Let me explain things in detail with examples.
Here8217s a one line script that displays the value of variable 8216var8217.
I set the value of this variable to LHB what do you think will be displayed when the script is run.
News Link: https://linuxhandbook.com/subshell/.