1. If Judgment statement:Integer judgment:-eq equals-lt less than-gt greater than-le less than equals-ge greater than or equal to-ne not equal tostring judgment:-Z is null-n NOT NULL = equals! = is not equal to \> greater than \Logical judgment:-A
The shell is a command interpreter that provides user and machine interaction before
Command historyPress UP ARROW key to appear before order historyHistory View Previous commandsThe command history exists in the file. Bash_historyThe maximum
A goal is a dream with a deadline. Much effort, Much prosperity.Why Encrypt shell scripts? Of course it's for security!Maybe the script involves a password or something, and it needs to be encrypted.I. Download and install the SHC toolTo protect
Composition + Execution
Need to add #! at the beginning /bin/bash
Lines that begin with # are interpreted as explanatory notes
The name of the script ends with. SH and is used to differentiate between this is a shell script
Script Requirements:After executing the scriptAccepts input 1, displays the current time, and prompts you to continue the selection.Accepts input 2, displays the CPU load, and prompts you to continue the selection.Accepts input 3, displays the
The grep command retrieves the rows in the file that contain keywords (which can be used), and is case-sensitive by default. Use the-c parameter to get the number of rows that contain the keywordUse the-n parameter to display the line number at the
Design a script that monitors the surviving state of a remote machine (assuming IP 123.23.11.21) and sends a message to yourself when it finds an outage.Tips:1. You can use the ping command: PING-C10 123.23.11.212. E-mail script can refer to: https:/
There is a server as a Web application, there is a directory (/data/web/attachment) is not timed to be uploaded by users of new files, but do not know when to upload. So, we need to do it every 5 minutes to detect if a new file is generated. Please
What does it mean to move the parameter left? This parameter refers to the arguments that follow the script name when you run the script, you can use the $ #来获取参数的个数, use $* to get all the arguments, and the left side of the argument is this: there
The shell's functions are the same as Javacript and PHP's function declarations, except that when the shell calls the function, it can call the function simply by writing the function name, noting that parentheses are not appended to the function
8.6 Pipe symbol and job controlPipe symbol | is to give the result of the previous order to the following command.Using this file for experimentation, Vmstat 1 is a constant display of some state of the system.Re-testing Jobs BG FG is a featureMove
The file name of the shell script usually ends in. sh, or in other formats, such as. txt or even without a suffix. The #!/bin/bash of the first line of the script represents the parser that specifies when the script executes.#!/bin/bash# file name:
RegularGrepMatch, and can display the colorfilter, display line numbers, case sensitiveGREP-V ReverseTake 2 lines, next 2 lines, two rows above and belowLines that begin with #Do not print the beginning of the #, for example, when looking at the
(1) SED effectSED is a non-interactive text editor, and the Contrast VI (VIM) is an interactive editor(2) SED syntaxsed [-option] [command] FilesComments:SED tool default processing text, text content output screen has been modified, but the
(1) awk principleThe principle of awk is to process the data in a file line by row, find content that matches what is given on the command line, and then program the next step if a match is found. If no match is found, continue with the next line.(2)
OneScript code: test.sh"Shell passed argument instance!" "; "file name executed: $"; "The first parameter is: $ $"; "The second parameter is: $"; "The third parameter is: $ $";Execute the file name:./test. SH The first parameter is:1 the
1.shell (Bourne Agin Shell) is a command parser that provides interaction between the user and the machine, as well as zsh, Ksh2. Where are the orders that we have knocked on? In the. bash_history file in your home directory, you can save up to 1000
This sort algorithm is very powerful, I personally like this algorithm, but the time complexity of the algorithm is difficult to calculate. The algorithm's choice of increments (here also called step) also needs to be noted, remembering only the
Lite version:Definition: your_name=123 ps:= symbol can not have space around! Use: ${your_name}, you can use the variable alone without {}Read only: readonly your_name PS: not deleted after set to read-onlyDelete: unset your_nameQuotation marks:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service