The use and setting of a variable (note that there can be no spaces before and after the equals sign)
1. Read
Read the input from the keyboard assignment to the variable, using the following method
[Email protected]:/opt/android-sdk/sdk/# read Var_readthis is ' What I get ' from my Keyboard[email protected]:E Cho ${var_read}this is that I get from my keyboard
2. Declare
Declare variables, if not add declare when defining variables, actually the same effect
[Email protected]:/opt/android-sdk/sdk/# declare a=hw[email protected]:/opt/android-sdk/sdk/# b=hw[ Email protected]:echo ${a}hw[email protected]:echo ${b}hw
Also, if the DECLARE command has another syntax:
-A sets the following variable to array
-I set the integer to the back of the change
-R Sets the following variable to read-only
3. Export
Change the following variable into an environment variable, which can be seen in all shells
[Email protected]:/opt/android-sdk/sdk/# var_1=hw[email protected]:/opt/android-sdk/sdk/# Export var_1 [Email protected]:/opt/android-sdk/sdk/# export VAR_2=HW
4. Array
How to define an array: var[index]=content
Linux Bash Shell Basic syntax