Rules for variable definition

 A variable name could contain any alphabet (a-z, A-Z), any digits (0-9), and an underscore ( _ ). However, a variable name must start with an alphabet or underscore. It can never start with a number. Following are some examples of valid and invalid variable names:

  • Valid Variable Names
ABC
_AV_3
AV232
  • Invalid variable names 
2_AN
!ABD
$ABC
&QAID

Note: It must be noted that no other special character except underscore can be used in a variable name because all other special characters have special meanings in Shell Scripting.

Shell Scripting – Shell Variables

A shell variable is a character string in a shell that stores some value. It could be an integer, filename, string, or some shell command itself. Basically, it is a pointer to the actual data stored in memory. We have a few rules that have to be followed while writing variables in the script (which will be discussed in the article). Overall knowing the shell variable scripting leads us to write strong and good shell scripts.

Similar Reads

Rules for variable definition

A variable name could contain any alphabet (a-z, A-Z), any digits (0-9), and an underscore ( _ ). However, a variable name must start with an alphabet or underscore. It can never start with a number. Following are some examples of valid and invalid variable names:...

Defining Variables

Syntax...

Variable Types

We can discuss three main types of variables:...

Few more examples in Shell Scripting and Shell Variable

How to Store User Data in a Variable?...