Using the shell to write 99 multiplication tables, MySQL sub-Library backup

Source: Internet
Author: User

Print 99 multiplication table: #!/bin/bashfor num in ' seq 9 ' does for NUM1 in ' seq 9 ' do if [$num-ge $num 1]; Then if ((($num * $num 1) >9) then Echo-ne "${num}x${num1}=$ (($num * $num 1) \ t \" Else Ech O-ne "${num}x${num2}=$ (($num * $num 1) \ t" fi fi Doneecho-ne "\ n" Done

Enterprise advanced practical case for the FOR Loop statement:

The command to create a database without logging in to MySQL is mysql-uroot-p***-S, data/mysql.sock-e "create db dbname";

Simulate a production environment, create a library, and then perform a sub-library backup.

#!/bin/bashexport lang= "ZH_CN. UTF-8 "Path=/usr/local/mysql/bin: $PATH #user=root#passwd=123456backup=/tmp/backupsock=/var/lib/mysql/mysql.sock# Comm= "MYSQL-UROOT-E" CREATE Database $dbname "" [!-D $backup] && mkdir $backupfor dbname in a B CDO echo "created Dbname$dbname "Mysql-uroot-s $sock-E" CREATE Database $dbname "echo" Start Backup $dbname "Mysqldump-uroot-s $sock $d bname | Gzip >> $backup/"$dbname" _$ (date +%f). Sql.gzdone


Using the shell to write 99 multiplication tables, MySQL sub-Library backup

Related Article

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.