Use of arrays
$array _var= (1 2 3)--use parentheses to define an array with a column value
$echo ${array_var[0]}--The first element of an array
$array _var[0]= "Zero"--defines an array using the form of an index and a value
$echo ${array_var[@]}--Print all array objects
$echo ${#array_var [*]}--Print array length
¥echo ${!array_var[*]}--iterating over the index value of an array
Use of associative arrays
Bash-version--Review the version information for Bash before introducing an associative array after bash4.0. You can use any text as the index value for bash.
Declare-a Array_var--defining associative arrays
$array _var= ([apple]=9.9 [banana]=5.5)--Array Association values
$array _var[orange]=3.2-- define an array using the form of an index and a value
$echo ${!array_var[*]}--iterating over the index value of an array
Using aliases
$alias xx= "Ls-al"--alias XX, represented in the current process Ls-al
$unalias xx--cancels the alias.
$ Echo ' Alias xx= ' Ls-al ' >> ~/.BASHRC--file. BASHRC, each process is read and will be permanently active. Remove the alias when you don't need it.
$alias rm= "CP [email protected] ~/backup;rm [email protected]"--Define an alias RM and keep a copy of the delete operation.
Shell script Programming {3} per day