01. Environment variable = + user-defined variables take effect only in the current shell, and environment variables take effect in the current shell and all child shells of the shell.
If you write the environment variable to the appropriate configuration file, the environment variable will take effect in all the shells,
02. Setting Environment Variables = = Export variable name = variable Value
Declaration variables
View variables = env
View variable contents = Echo $ variable name
Delete variable = = unset variable name
03, the system common environment variables
(01) path to the System Lookup command
(02), PSI defines the system prompt variable
For example: [[email protected] ~]# psi= "[\[email protected]\t \w]\$": \u: Represents the root;\t on behalf of the hostname; \w (w lowercase, uppercase means absolute path) represents ~
04. Position parameter variable = write to script file
Example: Create a script canshu.sh: write echo $ echo echo $ echo $
Echo $0:$0 represents the command itself, and $1-$9 represents the first to the Nineth parameter.
When executing the script file:./canshu.sh 11 22 33
05. Pre-defined variables
$$: Output when the forward PID
This PID is the PID of the generated process when variable,sh this script executes;
06. Receive keyboard input = + red [option] [variable name]
-P "prompt message": When waiting for the read in and out, the output prompt read command will wait for user input, use this option to specify the time to wait
The-t:read command waits for user input, using this option to specify the wait time
-N Character number: The Read command accepts the specified number of characters and executes
-S: Hide input data, apply to confidential information input
For example:
Linux Shell Basics-Bash variables-environment variables-positional parameter variables-predefined variables