Bash Variable type
Environment variables
Local variables (local variables)
Positional variables
Special variables
Local variables:
Varname=valoe: scope for the entire bash process
Local variables:
Local Varname=valoe: Scope is the current code snippet
Environment variables:
Similar to local variable: scope is the current shell process and its child processes
Export Varname=valoe
Positional variables:
$ =
Special variables:
$?: Execution status return value of previous command
Program execution, there are two types of possible return values:
1. Program execution Results
2. Program Status return code (0-255)
0: Indicates proper execution
1-255: Indicates error execution, 1,2,127 system reserved
Undo Variable:
Unset VARNAME
View variables in the current shell
Set
View environment variables in the current shell
Printenv
Env
Export
The script starts a child shell process when it executes
command-line-initiated scripts inherit the current shell's environment variables
Scripts that are automatically executed by the system do not inherit and need to be self-defined environment variables
Script: Command stack, according to the actual needs, combined with the command flow control mechanism to implement the source program
The first line of the script must define its execution shell example: #!/bin/bash
This article is from the "Carey" blog, make sure to keep this source http://careygg.blog.51cto.com/11084669/1734136
Bash script programming variable one