标签:utf-8 乘法表 com 备份 roo usr done mkdir pat
打印99乘法表: #!/bin/bash for num in `seq 9` do for num1 in `seq 9` do if [ $num -ge $num1 ]; then if ((($num*$num1))>9) then echo -ne "${num}x${num1}=$(($num*$num1))\t" else echo -ne "${num}x${num2}=$(($num*$num1))\t" fi fi done echo -ne "\n" donefor循环语句的企业高级实战案例:
不登陆mysql创建数据库的命令为mysql -uroot -p*** -S 、data/mysql.sock -e "create database dbname";
模拟生产环境,创建库然后进行分库备份。
#!/bin/bash export LANG="zh_CN.UTF-8" PATH=/usr/local/mysql/bin:$PATH #user=root #passwd=123456 backup=/tmp/backup sock=/var/lib/mysql/mysql.sock #comm="mysql -uroot -e "create database $dbname"" [ ! -d $backup ] && mkdir $backup for dbname in a b c do echo "创建dbname$dbname" mysql -uroot -S $sock -e "create database $dbname" echo "开始备份$dbname" mysqldump -uroot -S $sock $dbname | gzip >> $backup/"$dbname"_$(date +%F).sql.gz done
标签:utf-8 乘法表 com 备份 roo usr done mkdir pat
原文地址:http://blog.51cto.com/11726212/2071511