Take the CentOS system as an example to realize automatic database backup.1. Write a shell:
12
#! /bin/bashMysqldump -cp --user=root --password=' 123 ' dbName | gzip > ~/db/dbname -'date +%y%m%d%H '. SQL. GZ ;
Use the-e parameter of MySQL can perform various kinds of SQL (create, delete, add, erase, change, check) and other operationsUsageMysql-uxxx–pxxx-e "MySQL Command" Of course, you can also use the following notation MYSQL-E-uxxx–pxxx "mysql
The nature of the shell
The shell of the Linux system is equivalent to the "one shell" of the operating system, which is the command language interpreter, which provides the user with an interface to use the operating system. It does not belong to
Original blog, reproduced please indicate the sourceThe shell is the command interpreter.See which shells are supported by this system1 Tab Command completionThis almost every time can be used, for example, I have a file called file.txt, assuming
Of course this blog original code is reproduced great God's ...Automatically install Nginx script, use case mode, choose the way, you can change to the actual needs of the script you want mynginx.sh
#!/bin/sh
# # #nginx Install Shell
# # #
SummaryThis chapter describes how to use ls and stat to expose files and file meta data , and how to use Touch set the time stamp not seen . Touch can display information about datetime and scope limitations on many existing systems .Shows how to
Today, a friend suddenly asked me in the shell, how to compare floating point and integer, but I asked a Leng, in the work did not encounter this scene. We also know that the calculation of numbers in the shell is usually converted to integers, such
Using SH to write small scripts can make the job easier. Part of the content may be more unfamiliar to everyone (at least I am).is the variable related to the expansion, the following are some simple description and use of the method. To make the
Add 20 users to the CLASS01 group in bulk, the user name begins with STD, ends with a number, format: STD01---STD20Method 1#!/bin/shgroupadd class01a=stdfor ((i=1;iMethod 2:#!/bin/bashgroupadd class01for i in {1..20}doif [$i-lt];thenuseradd "std0$i"-
Cat: View the contents of a file, connect a file, create one or more files, and redirect output to a terminal or file usage: cat [options] [file]1. $ Cat Hello.txtdisplaying content in a hello.txt text file2. $ cat-n File-N option to display the
File comparison Operators-e filename true if filename exists [-e/var/log/syslog]-D filename True if filename is a directory [-d/tmp/mydir]-F filename True if filename is a regular file [-f/usr/bin/grep]-L filename True if filename is a symbolic link
Sometimes the shell has a variable number of arguments, want to get the 2nd bit after the argument, as a new entry to invoke other scripts the usual way to think of this is to use traversal, for example, the following method:For ((i=2;i DoEcho $i
Today to write blog only to find before there is no written, my God, I was asleep ...1, what is a shell?The shell is a unix/linux system with software that acts as an interface between the kernel and the user, reads the user's input command, sends
1. Regular expressions1) ^ Start * Previous character repeats more than 0 times+ More than 1 times? 0 or 1 times. An arbitrary character (. *){m,n} m to n times[0-9] [A-z] any number or letter$ end Character2) sed and awk commandsSed ' match
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.