1:declare command
shell Default is String type
If subtraction is required, it needs to be defined as an integral type
DECLARE command: Change the default variable type Decalre [+/-] [option] Variable name
-set type properties for variables
+ Cancel Variable Type property
-a declares an array type
-I declaration as Integer
the-X sets the variable to an environment variable equivalent to the Export command Declare-x test=123 (export is a simplified command. The final execution is the declare-x command)
-R variable declared as read-only variable
- p Displays the declared type of the specified variable
eg:
declare-i cc= $aa + $bb
Echo $CC
-
View variable properties declare-p cc
eg:
declare-p cc
declare-i cc= "
Array:
Movie[0]=zp
Movie[1]=tp
Movie
-bash:movie:command not found
echo $movie [1]
Echo ${movie}
Zp
Echo ${movie[1]}
Tp
Echo ${movie[*]}
ZP TP
[Email protected] ~]#
2: Array Operation method
3. Variable Testing
The variable test method, which only takes effect for the shell, does not exist in other general languages.
Three: Shell operators