[root@shnne ~]# vim test.sh
#!/bin/sh
for ((i=0; i<=5; i++))
do
if [ $i -eq 3 ]
then
#contin...
1.
创建
[root@shnne ~]# cat mk.sh
#!/bin/sh
for((i=1; i<=10; i++))
do
j=`cat /dev/urandom|head -1|md5sum|cut -c 1-5`
touch shnne/${j}_shnne_$i.html
don...
通过for循环打印5 4 3 2 1[root@shnne ~]# cat for1.sh
#!/bin/sh
for i in 5 4 3 2 1
do
echo $i
done
[root@shnne ~]# cat for2.sh
#!/bin/sh
f...
[root@shnne ~]# cat sum_*
#!/bin/sh
sum=0
i=1
while [ $i -le 100 ]
do
let sum=sum+i
let i=i+1
done
echo $sum
#!/bin/sh
sum=0
i=1
while ((i&...
[root@shnne ~]# cat rsync_start.sh
#!/bin/bash
# chkconfig: 2345 58 80
# description: start and stop service for rsync
. /etc/init.d/functions
RSYNCBIN=&q...
echo -e "\033[30m 黑色字 \033[0m"
echo -e "\033[31m 红色字 \033[0m"
echo -e "\033[32m 绿色字 \033[0m"
echo -e ...
[root@shnne ~]# cat nginxd.sh
#!/bin/bash
# chkconfig: 2345 58 80
# description: start and stop service for nginx
#定义的变量最好是大写.
nginx_bin="/application/nginx/sbin/nginx"
pid="/application/nginx1.6.2/logs/nginx.pid"...
#!/bin/sh
port=`netstat -antup|grep mysqld|wc -l`
process=`ps -ef|grep mysqld|grep -v grep|wc -l`
if [ $port -ne 1 ] && [ $process -ne 2&nb...
判断内存小于100,邮件报警[root@shnne ~]# sh baojing.sh
the mem is 570,it's ok.
[root@shnne ~]# vim baojing.sh
#!/bin/sh
memvalue=`free -m|awk 'NR==3 {print $...
#!/bin/sh
#defined the number
read -p "please input two number:" a b
[ -z "$a" ] || [ -z "$b" ] && {
&n...