1.Shell command line writing rules:
Multiple commands can be executed on a command line, but required;
Long command statements can be expanded with \ on the command line
2. Execute Shell Program
2.1./test.sh
2.2 Bash test.sh
2.3 In order to compile and execute the shell-written program in any directory, add the/bin directory to the entire environment variable
Export Path=/bin: $PATH
test.sh
3. Parameters used in shell programs
3.1 Position parameters
The parameters provided by the system are called positional parameters, and the values of positional parameters can be obtained by $n, and Linux will fragment the input command string and label each segment, starting from 0. Number No. 0 indicates the program name, starting with 1, indicating the parameters passed to the program, and so on.
3.2 Internal parameters
$: command contains the path of the command
$#: The total number of arguments passed to the program
When the $?:shell program exits in the shell, the normal exit returns 0, whereas a non-0 value is returned.
$*: A string that consists of all the arguments passed to the program
Shell Scripting Learning