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
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
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
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
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,
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
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
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 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
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
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
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
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
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
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 :,
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,Zookeeper accidentally called the home Directory deletion command today. Although it was not deleted for various reasons, many files and directories in the home
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.