Routine maintenance requires a generic execution shell, but the CentOS 6 version is different from the 7 version of the command, and needs to be judged by the program itself, as follows:1. View cat/etc/centos-release[Email protected]/0 #
1.if judgment① simple judgment, if the condition is met, return OK#!/bin/basha=5if [$a-gt 3]then echo "OK" fi[[email protected] test_shell]#./test.shok② two conditions, you can use elif and else#!/bin/basha=5if [$a-lt 3]then echo "Common symbols in
Crontab can execute a shell script and execute a series of Linux commands at a specified timeExample: Server administrator regularly backs up database data, logs, etc.DetailedCommon commands:Crontab–e //Modify the crontab file, if the file does
CommonCtrl+r: Quick Search History Command (Retrieve)Ctrl+u: Delete entire command line text character (Unity)Ctrl+s: Pausing a Running program (STOP)Ctrl+q: Exit Pause (quit)CTRL + Z: Enables tasks that are running in the terminal, running in the
Processing of strings1. Interception of stringsMethod one, using the ${} expressionFormat: ${var: Start position: Length}Phone= "13788768897" # echo ${#Phone} 11 When you use ${} to intercept a string, the
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
1. Variable assignment:NAME=LBG equals sign cannot have spaces name= "Lebron James" variable values have spaces in double quotes Echo ${name} with ${} More insurance shopt-s-O Nou Nset setting "Declare and use first"2. Cancel the variable:unset
First, IntroductionIt is an executable file. Design executable statements in advance to accomplish specific tasks1.1 Common script typesBash ShellPython/perl/rubyjsp/php/asp/cgiJavascriptThe biggest advantage of 1.2 shell languageCan be fully
The SED stream editor is also a command in Linux that is often used in the shell to modify the contents of a file in a non-interactive way. The SED handles the text in rows, that is, one row at a time.The basic format of the SED command is:sed
The following is a syntax format for input and output redirection
Two overview Output input redirectionGreater than sign >: Indicates output redirection (overwrites the original file)Less than Double greater than sign >>: (indicates output
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
The execution name of this program$n the nth parameter value of this program, n=1..9$* all parameters of this program, this option can have more than 9 parameters.$# the number of parameters for this program$$ the PID of this program (the current
The issue cannot be removed after using HBase shell entry in Xshell:In the HBase shell, the wrong input instructions can not be deleted using backspace and delete, the use of the people know that this is a lot of pits, there is much distress!OK,
#!/bin/bash#第一次运行创建记录文件-f 1.txt || touch 1.txtwhile :do #查看日志中登陆失败的ip次数超过10次的用户ip fip=`awk ‘/Failed/{ip[$11]++;}END{for (i in ip){if (ip[i]>10){print i}}}‘ /var/log/secure` #循环取出登陆失败超过十次的ip进行处理 for i in $fip do #查看处理记录文件如果该ip没有存在处理记录中说明是没有处理过该ip
Note Using expr:The operator and the number used for the calculation have at least one space around it, otherwise the errorWhen using multiplication sign, a backslash must be used to mask its specific meaning.An enterprise-class case study of
#!/bin/bash#from为压缩包批次所在目录#basetarpath to count the total length of time per batchFrom=$1Basetarpath=$2suffix= "Tgz"Todir= $basetarpathoutdir= $basetarpath/home/iflytek/outif [!-d? $from]; ThenExitFiif [!-D $basetarpath];thenMkdir-p
0x00 Preface
Scanner Scan to a website exists directory browsing, so there is this article ...Knowledge Point Popular Science:1. Directory browsing
Directory browsing in my personal view is a significant vulnerability, the
Conditional test Syntax:Syntax 1:test This is the method of conditional test expressions with the test command.Syntax 2:[]: This is the way to test an expression with a single parenthesis, as with the use of the test command, the recommendedSyntax 3
There are two types of data in the shell: one is a numeric type, the other is a string type , and although the shell itself is a weak type, it can be so distinguished.If we need to store multiple values in a variable in the shell, we need a more
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.