Linux learning Shell Script summary

1. Shell script is a "program" written by using the function of the shell. This program uses a plain text file to write some shell syntax and commands in it, with functions such as regular expressions, pipeline commands and data stream redirection. , in order to achieve the processing purpose we want

2. Shell script is a good tool for system management, but it is not good enough for processing a large number of numerical operations, because the speed of shell script is relatively slow and it uses a lot of cpu resources, resulting in the loss of host resources. Poor allocation.

3. In the shell script file, the command is analyzed and executed from top to bottom and from left to left.

4. The execution of shell script requires at least the authority of r. If direct command execution is required, the authority of r and x is required.

5. In a good program writing habit, the first line should be the shell (#!/bin/bash), and the second line and later the program purpose, version, author, etc.

6. Conversational scripts can be achieved with the read command

7. To create data with different results each time the script is executed, use the date command to use the date to achieve

8. If the execution of script is executed by source, it means that it is executed in the bash of the parent process.

9. If you need to make judgments, you can use test or square brackets ([]) to process

10. In script, $0, $1, $2,,,,,,$@ have special meaning

11. The conditional judgment can be judged by if...then. If the content of the variable is fixed, case $var in...esac can be used to process it.

12. The loop is mainly divided into indefinite loop (while until) and fixed loop (for), cooperate with do and done to achieve the required tasks!

13. You can use sh -x script.sh to debug the program

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326671085&siteId=291194637