A variable is a character string to which we assign a value. The value assigned could be a number, text, filename, device, or any other type of data.
A variable is nothing more than a pointer to the actual data. The shell enables you to create, assign, and delete variables.
Variable Names:
The name of a variable can contain only letters ( a to z or A to Z), numbers ( 0 to 9) or the underscore character ( _).
By convention, Unix Shell variables would have their names in UPPERCASE.
The following examples are valid variable names:
_ALI
TOKEN_A
VAR_1
VAR_2
Following are the examples of invalid variable names:
2_VAR
-VARIABLE
VAR1-VAR2
VAR_A!
The reason you cannot use other characters such as !,*, or - is that these characters have a special meaning for the shell.
Defining Variables:
Variables are defined as follows::
variable_name=variable_value
For example:
NAME="Zara Ali"
A variable is nothing more than a pointer to the actual data. The shell enables you to create, assign, and delete variables.
Variable Names:
The name of a variable can contain only letters ( a to z or A to Z), numbers ( 0 to 9) or the underscore character ( _).
By convention, Unix Shell variables would have their names in UPPERCASE.
The following examples are valid variable names:
_ALI
TOKEN_A
VAR_1
VAR_2
Following are the examples of invalid variable names:
2_VAR
-VARIABLE
VAR1-VAR2
VAR_A!
The reason you cannot use other characters such as !,*, or - is that these characters have a special meaning for the shell.
Defining Variables:
Variables are defined as follows::
variable_name=variable_value
For example:
NAME="Zara Ali"