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
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
#!/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
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
first, the circulation 1. Indefinite circulation There are two kinds of forms: while [Condition] state in parentheses is the beginning of the loop of the judgment do done do is the end of the loop When the condition condition is established,
vim/root/7.sh#!/bin/bashX=$[RANDOM%10+1]Read-p "[1-10] you guessed:" CaiIf [$cai-eq $X];thenEcho, congratulations on your guess.Exitelif [$num-gt $X];thenEcho's a big guess.ElseEcho's too small.Fivim/root/6.sh#!/bin/bashRead-p "Please enter a
Beta version: Easy cool cms2.5Contains a sentence: Http://localhost/ekucms2.5/?s=my/show/id/{~eval ($_post[x])}will generate an error log in the/temp/logs/directory of the website, naming rules for the year _ month _ DayError log contentsContains
First, the basic regular expression1. Regular expression: The regular expression is the string used to match the symbol condition in the file, and the Regex contains the matchinggrep, awk, sed, and other commands can support regular expressions.2.
Shell Introduction
The shell is a command interpreter that provides interaction between the user and the machine
Supports specific syntax, such as logical judgment, looping
Each user can have their own specific shell
CentOS7
Shell IntroductionThe shell is the intermediate medium used when the system interacts with the computer hardware, and it is just a tool of the system. There is a layer of things between computer hardware-the system kernel. If computer hardware is
One, variableA variable is a container in which different values can be placed.Key facts:Path,home,pwd,logname these are variables.Example:[[email protected] ~]# echo +ba+~]# echo $a +$b3+4~~ ]# echo $a 3$b4~]# echo $a"3"$b334 The summation of
1. Export path= $PATH:/usr/local/mysqlPut the $path in front, or to add to the path inside of the way to write the wrong words, you are tragic, processing is still more troublesome2. crontab inside Execute script remember Source/etc/profileCrontab
Write a script to find the/data/log directory, the last created time is 3 days ago, the suffix is *.log file, packaged and sent to 192.168.1.2 Service under/data/log, and delete the original. log file, leaving only the packaged
2. Case statementOnly one conditional relationship is judgedGrammar:Case¢ variable name in"Value 1")Procedure 1;;"Value 2")Procedure 2;;*)Procedure 3;;Esac3. For loop1) Syntax: (Assigning a value to a variable executor, several values are executed
Shell Common ScriptsAuthor:headsen Chen 2017-10-17 15:36:17Personal original, reproduced please indicate, otherwise, legal liability shall be investigated1,vim name.grep.sh2,cat tellme.sh3,cat idcheck.sh4,cat case.shNote: The file name is called in
To test the shell's looping nesting syntax1[Email protected] test]#VIXunhuanqiantao.SH 2#!/bin/Bash3 #程序功能描述:4 # test Loop nesting5 #作者: Lone boat Point6#版本:1.07#创建时间: .-Ten- A Geneva: $:
Shell programming echo command usage instructions, shell programming echo command
Shell echo commands are similar to PHP echo commands and are used to output values. We can use echo to implement more complex output format control.Show normal
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