Judge the CentOS system version of the shell

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 #

Logical judgment in the shell

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

Linux timed Execution Shell script command crontab

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

Linux Shell shortcut keys

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

Shell Script Foundation II

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

Shell programming------Judgment Statement

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

Shell programming------variables, assignments, and operations

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

DAY11 Shell Script Basics (enginner05-1)

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

Shell Programming Exercises

Topic One: Summation exercise:#!/bin/bashfunction Sumarray {Local sum=0Local arrayArray= (echo "[email protected]")For value in ${array[]}Dosum=$[$sum + $value]DoneEcho $sum}Wang= (1 2 3 4 5)echo "Initial data is: ${wang[]}"Kai=echo ${wang[*]}result=

Use of the SED command in the shell

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

About shell input and output redirection

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

Shell Scripting Encryption

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 meaning of $x in the shell

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

Unable to delete issue after using HBase shell in Xshell

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,

CentOS7 next shell script that exploits security day to firewall and prevents brute force

#!/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

Use of the expr operator for the shell

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

Shell decompression package, the sum of all the text of the packet under the recording duration

#!/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

One differential backup take the shell process

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 testing and comparison of shell scripts

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

An array of special variable types in the shell

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

Total Pages: 541 1 .... 439 440 441 442 443 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.