Shell Script (iii)

Automatically back up database scripts #!/bin/bash#auto Bakcup MySQL#by 2015-7-2Bak_dir= "/data/backup/' Date +%y%m%d '"Mysql_db=discuzMysql_user=rootmysql_pw=123456Mysql_cmd=/usr/bin/mysqldumpIf [$UID-ne 0]; Thenecho "must to is use the root

Shell Pull Process

#!/bin/shMm= ' Ps-ef|grep memcached|grep-v grep|wc-l 'While ["$MM"-eq 0]Doecho "$ (date +%y%m%d%h%m%s), the memcached is down,try to up it" >>/data/shell/men.log/usr/bin/memcached-d-u root-m 512-p 39999-c 1024Sleep 2sMm= ' Ps-ef|grep

Shell Learning Path: Process Control (while)

While Loop :Description: The while loop is an indeterminate loop, also known as a conditional loop. As long as the condition is judged, the loop will continue to execute until the condition is judged, and the loop will stop, which is not the same as

Shell Script (ii)

1.Until Loop statement#!/bin/basha=10;until [[$a-lt 0]];d oecho $a;((a--));d one;2.case Selection Statement#!/bin/bash#auto install lamp#by 2015-6-30case $1 in          apache ) echo  "Wait for install httpd server ..." yum  install http* -y;;       

Shell Scripting Basics (bottom)

Case judgment in the shellFormat: Case variable name invalue1)Command;;value2)Command;;*)Commond;;EsacIn a case program, you can use a |, meaning, or means in a condition, such as:2|3)Command;;When the variable is 2 or 3 o'clock, the part of the

Makefile shell script; sed command

1. To use the shell script in makefile, you need to add the "@" symbol, for example:@if [-D xxx]; Then \//-d to determine the existence, in the shell, with the [] number instead of parenthesesRM-RF xxx; \Fi@cp-FV xxx xxxx//-f Delete the existing

The classic shell surface question arrangement

First, remove the number of occurrences of the shell in the/etc/passwd file: Here is a partial content of a/etc/passwd file. The topic asks to take out the shell and counts the number, the shell refers to the back/bin/bash,/sbin/nologin and so on,

Shell script Run

The program must start with the following line (must be in the first line of the file): #!/bin/shThe symbol #! is used to tell the system that the parameter behind it is the program used to execute the file. In this example we use/BIN/SH to

Linux Shell Programming String stitching

If you want to add a character after a variable, you can use the following method: $value 1=home$value2=${value1}"="Echo$value 2 Add the string variable you want to add {}, and you need to put the $ out. The result of this output is: Home=, which

Shell Review notes----commands and Parameters

The basic job of the shell is to execute commands.The shell executes each command you type.$CD work;ls-l whizprog.cFirst: The format is simple, separating the various components of the command line with a blank Space key or TAB key.Second, the

Linux Shell Program Debugging

Linux Shell Program DebuggingThe shell program is debugged by adding relevant debugging options when running the program or by adding related statements to the script, allowing the shell program to display some "debug information" for reference

Shell Review notes----Find and replace

Find DocumentsIt is quite convenient to find text in the grep program (matching text matching). There are traditionally three programs that can be used to find entire text files. grep's oldest text-matching program. The simplest way is to

Shell Script Programming Basics *

The shell is an interpretive programming language.The execution of an interpreted script file:When an interpreted script file is executed, the script file is committed to the kernel. The kernel sees the first line of "#! "#! is called when the

Array of shell scripts

#!/bin/bash#你必须知道的shell里面关于数组的操作. Arr= ("Hello" "word" "You" "is" "a" "Good" "Boy.")#arr = (' ls ') #我喜欢这个方法. Echo "-------for----------------" forIinch ${arr[@]} Do Echo $I DoneEcho "--------for---------------" for((i=0;i${#arr [@]}; i++)) {Echo

Three vernacular classic Algorithm series Shell sort implementation

The mountain is the essence of the package insert sort sort. This method is also known as a narrow incremental sort because of DL. Shell to 1959 named.The basic idea of this method is to first cut the whole sequence of elements into several

Linux Shell expressions and linuxshell expressions

Linux Shell expressions and linuxshell expressions Strictly speaking, shell does not have the expression concept. Shell itself is actually a collection of a bunch of commands. Of course it is not just a collection of random together, but a certain

Linux Shell variables and linuxshell Variables

Linux Shell variables and linuxshell Variables M @ meng :~ $ B = 2 + 3 m @ meng :~ $ Echo $ b2 + 3 However, the declare command can be used to set the type of a variable. Currently, only integer and array types are supported. Now, consider

Shell basics 3: shell Basics

Shell basics 3: shell Basics Cut is a selection command: It is to analyze a piece of data and retrieve what we want. In general, the selection information is usually analyzed for "rows", not the entire information analysis. (1) The syntax format is:

In Linux, the shell variable $ #, $ @, $0, $1, $2 has the following meanings :,

In Linux, the shell variable $ #, $ @, $0, $1, $2 has the following meanings :, Variable description: $ PID (ProcessID) of Shell itself $! PID of the background Process last run by Shell $? End code of the last command (Return Value) $-Flag list

Centos shell command line only show-bash-4.1 # do not show the user and path solution,

Centos shell command line only show-bash-4.1 # do not show the user and path solution,Zookeeper accidentally called the home Directory deletion command today. Although it was not deleted for various reasons, many files and directories in the home

Total Pages: 541 1 .... 537 538 539 540 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.