In the shell script to do a variety of tests frequently, test the format of the statement:
(1) Test < test expression >
(2) [< test expression;
(3) [[< test expression "]]
Three kinds of differences, in the third can be a wildcard matching, and &&,| |,<,>, the operator can also be normal presence in [[]], but cannot exist in [].
File test operator
"Inode, save the file's meta information, such as file creator, file modification time, creation time, file size, etc., is the inode, Chinese is the index node, view the Inode method: Stat filename"
String operator and integer two-dollar comparison operator
When it comes to numerical calculation, try to use (()), in (()) to refer to the value of the variable, plus $ or not all can, in (()) Do not use the left and right spaces
Classification of Shell variables:
A read-only environment variable, (personally understood, is the execution of a variable submitted to a shell script through bash).
parameter variables and process state variables
Process state variable usage, command, script will return a status code,
Common error code, 1 generic error, 126----script does not execute permission 127 command not found.
echo $$-----PID for the current process
echo $? The return value of a command or script that was executed before-----
Echo $! -----The PID of the last job running in the background
echo $_ The last parameter of a command or script that was executed before-----