a) Local variables
Local variables are the one can which can be used in a private or single
environment that is these cannot be used in other shell scripts even with a
reference. These types of variables are used in short shell scripts.
b) Global variables
Global variables are also known as environmental variables. These
variables differ from the first one because these can be used in any shell
script with a reference. For using the global variables, you need to export
them to the local shell script file.
Variable naming
Variables present in the shell language
should follow some varied
instructions while naming. Remember that shell in-built commands like exit
cannot be used for the names of variables.
Here are the instructions that need to be followed for naming a variable:
a) In shell language, variables differ from the capital and small letters.
b) A variable name should never start with a number or special character.
Doing this may give an error saying that
the variable name cannot be
initialized.
Here are some of the various examples that can be used
love
dude
ra344
And here are some of the variable names that cannot be used
1hjsd
#feg e