What is shell variable?
A shell variable is a variable that is only available for the current shell. In contrast, an environment variable is available system-wide and can be used by other applications on the system.
Eine Shell ist der Befehlsinterpreter des Betriebssystems. Es verarbeitet die in der Command line eingegebenen Befehle oder liest sie aus einer Shell-Skriptdatei.
A variable is a location in memory that is used to store a value. This place has a name to make it descriptive. The value can be any type of data such as name, number, text or file name / directory. A variable is nothing more than a pointer to certain data.
A shell enables a user to create, assign, or delete variables. However, these variables are only temporary and are automatically cleared when the shell session is closed. To make a shell variable persistent and available system-wide, it must be exported and converted into an environment variable. The command used for this depends on the shell used. In the bash shell used by Linux, the command is "export".
A shell variable is created with the following syntax: "variable name = variable value". For example, the command “set COMPUTER_NAME = mercury” creates the shell variable “COMPUTER_NAME” with the value “mercury”.
Quotation marks must be used for values with spaces. Although not required, the Unix convention is to use uppercase letters for the variable names. Under Unix, variable names such as file names are case-sensitive.