BackgroundJenkins executes the shell command, which references some Jenkins variables, such as ${workspace}, because each execution of Jenkins is slow, so I want to copy the script to local debugging, directly copied the script to execute, 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
First, shell special symbol Cut commandA command that intercepts a field: cut-D: followed by delimited characters, separated by single quotation marks-C: followed by the first few characters-F: The next section is followed by the number of blocks-D
Vi. condition testing and selection 6.1 test expression-file Status Test6.1.1 [-E file]File exists with a value of true;file does not exist as false6.1.2 [-D file]File exists and is a directory with a value of true;file does not exist as false6.1.3 [
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 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
What I want to share with you today is the "shell script", one of the knowledge points I learned in the nineth day of operations, and I've seen the teacher write some simple scripts before class, when I felt that the script was a very tall thing,
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
#!/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
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
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
Experimental material:[[email protected] test]# ls//This directory contains all the files ending in. txt and requires all to be replaced by the. Doc End1.txt 2.txt 3.txt 4.txt 5.txtWriting scripts[Email protected] test]# vim/root/25.shScript content:
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
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
In the virtual machine Win7 system python2.7, the skier Game (code handwriting) in the parent and child is run in this Python,The following problems occur:================ restart:c:\python27\scripts\skier\skier.py ===================================
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