Shell regularly backs up database information

#!/bin/SH# DatabaseInfoDb_user="batsing"Db_pass="BATSINGPW"Db_host="localhost"db_name="Timepusher"# Others Varsbin_dir="/usr/bin"#the MySQL bin Pathbck_dir="/mnt/mysqlbackup"#the Backupfiledirectorydate=`Date+%F ' #

Shell Test Value string file comparison

A comparison of the numerical values Describe N1–eq N2 As N1–GT N2 Greater than N1–ge N2 Much more than N1–lt N2 Less than N1–le N2 As small as

Shell Learning--grep1

I. SOURCES of grepTo find a string by using the EX Editor::/pattern/pwhere P is printed, the first line containing the string pattern is printed, if you need to print all lines that contain pattern, you can::/g/pattern/pWhen G appears in front of

Casing conversion in Shell

There are two ways of doing this:1, with TRExample: uppercase=$ (echo $VARIABLE | tr ' [A-z] ' [A-z] ') (convert VARIABLE lowercase to uppercase)lowercase=$ (echo $VARIABLE | tr ' [A-z] ' [A-z] ') (convert VARIABLE uppercase to lowercase)2, with

Basic job of Shell script

1, write script/root/bin/systeminfo.sh, display the current host system information, including host name, IPV4 address, operating system version, kernel version, CPU model, memory size, hard disk size.#!/bin/bash# author:huiping# version:1.0.1# date:

Shell Learning Note 1

Brief description of single quotes, double quotes, and unquoted Name Explain Single quotation marks What you see is what you get: Everything inside a single quote is output as it is, or what you see in single

12. Start the shell script

ObjectiveWhat the hell is a shell? Before this, we should understand the issue of file permissionsBody Shell versionVarious versions: Bourne Shell (SH), C Shell (CSH), and Korn Shell (Ksh)And at present:The common and CentOS default

Shell Script---syntax chapter

1. Condition test1) test2) [650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/85/99/wKiom1epiarg-HB5AABchcrnS3o789.png-wh_500x0-wm_3 -wmp_4-s_2416745738.png "style=" Float:none; "Title=" Captures 4. PNG "alt=" Wkiom1epiarg-hb5aabchcrns3o789.

The Shell's awk little memory

Awk is a powerful text analysis tool, with the search for grep and the editing of SED, which is especially powerful when it comes to analyzing data and generating reports. To put it simply, awk reads the file line-by-row, using spaces as the default

Variables of Shell programming

Bash variables: User-defined variables, environment variables, positional parameter variables, predefined variablesUser-defined variables:#变量赋值等号两侧不能有空格#调用变量加 $ eg. Echo $x#变量的叠加: x= "$x" 456 or x=${x}789Set #查看变量Set-u #echo时看变量是否存在unset variable

The shell string operator

${varname:-word}If varname exists and is not nil, returns the value of VarName, otherwise returns word. This is commonly used to return a default value when VarName is undefined${varname:=word}If varname exists and is not nil, return the value of

Spark Shell:wordcount Spark Primer

1. After installing Spark, enter spark in the bin directory: Bin/spark-shell scala> val textfile = Sc.textfile ("/users/admin/spark/ Spark-1.6.1-bin-hadoop2.6/readme.md ") scala> Textfile.flatmap (_.split (" ")). Filter (!_.isempty). Map ((_,1)).

Loop statements in the shell

For syntax formatfor Var in list;doCommandsDoneWhere list can contain:1) write directly for in a b c D; do Echo $alpha Done2) variableslist="a b c d" for in $list; do Echo $alpha DoneThe variable is replaced when the shell executes, and

Shell redirection and file descriptors

ExplainRedirect: Is an action, an Operation action actionFile descriptors: Nouns, another representation of a file, Linux everything is file."Base redirection form" Input redirect Usage Rating: * *

Path expansion in the shell

Glob extensionIn the path extension in the shell, there are several glob involved:? Match any single character* Match 0 to more characters[Set] matches any one of the characters in the set, such as [0-9], matches any number[!set] matches any

Shell script automatically pull black SSH login failed more than 3 times IP

#!/bin/bash#Created by T.sweetIptables_file=/etc/sysconfig/iptables #防火墙配置文件Ip_addr= ' Tail-n 500/var/log/secure | grep "Failed Password" | awk ' {print $11} ' | uniq-c | awk ' $1>= 3{print '#取出登录错误3次以上的IPCat $iptables _file | grep $IP _addr

Shell Programming-Regular expressions

1. What is a regular expressionIt is mainly used for string pattern segmentation, matching, finding and replacing operations.2. Regular expressions and wildcard charactersA regular expression is used to match a qualifying string in a file, and the

Shell command Merge Text

Before I wanted to print out the code, it seemed that, after merging, I found that there were more than 2000 pages in Word and then dropped the ~anyway, which was very useful.For example I have text A001.dat, A002.dat, A003.dat ... and then want to

The expr command in the shell

Expr can do the following:Logical operationsArg1 | Arg2 logic or operation, true return arg1, otherwise return arg2 (null or to determine the true and false parameters, there is a short-circuit function)Arg1 & arg2 Logic and operation, true return

Shell Simple usage note (Shell numeric operations) two

The value of the variable in the shell, if you do not specify the type manually, the default is the string type:For example:A=123b=456C= $a +#becho $cThe result is output: 123+456In the shell, if you want to perform numeric operations, you can do

Total Pages: 541 1 .... 374 375 376 377 378 .... 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.