1. User-defined variable user-defined variables have alphanumeric and underscores, and the first character of the variable name cannot be numbers. Like other UNIX names, the variable name is sensitive. For variables, users can press below Method assignment: Name = value When references the variable, you need to add $ symbols in front, and users can assume each other in the variable, such as: (previous $ is a command prompt) $ john = john $ name = $ john $ echo Hello $ Name Hello John can also form new words with variables and other characters, which may need to enclose the variables to {}, such as: $ SAT = SATUR $ Echo Today IS $ {SAT} Day Today IS SaturDay for unfamed Variables, Bash is treated with null, and users can also use the unset command to clear the value assigned to the variable. It is also possible to use an array variable in Bash: (1) name [index] = value (2) name = (Value1 ... Valuen) At this time, the subscript has no restrictions from 0 to the range of array, and it is not necessary to use continuous components. The built-in command for variables in Bash is: (1) Declare and TypeSet. Both have the same Features. The options are: [- / ] a Set / Undo Variable Array Properties [- / ] Iset / Undo Variable Integer Properties [- / ] R Setting / Undo Variable Cluster "[- / ] X Set / Undo Variable Output Properties - P Var Display Variable Attributes (2) Export and local. Export outputs variables to the environment, usage is: export name export name = value, you need to briefly introduce Export's role: When the Bash Shell executes a program, it will first create a new execution environment for the program. It is called a sub-shell, and the variables in the Bash Shell are local, that is, they are only meaningful in the sub-shell that creates them. After Export, the variable is set to global variables, which can be identified by other child shells. Local tag variables are local (if can be used inside the function), usage is: local name local name = value (3) readonly. The specified variable is read-only, after execution, the change can not be assigned again, usage is: readonly Name 2. Position variable or shell parameter Bash Shell When explaining the user command, the first child of the command line is used as a command, while other words are passed to the program as a parameter via the position variable. $ 1, ..., $ 9 representative First, ..., nine parameters. Where 1-9 is the real parameter name, "$" is just a replacement of the variable. The location variable is the executable corresponding to the command. Other also: $ # Parameters give to the command $ @ @