1.编写99乘法表
#!/bin/bash
for((i=1;i<10;i++))
do
for((j=1;j<=i;j++))
do
echo -n "$i $j = $(($i$j))"
echo -n " "
done
echo " "
done
考查for循环的使用
2.nginx的安装脚本
3.nginx的启动脚本【启动命令】
#/bin/bash
nginx_path=/usr/local/nginx/sbin/nginx
params=$1
if [ -z $params ]
then
echo "input params start or stop"
exit
fi
case "$1" in
"start" )
$nginx_path
num=`ps aux | grep nginx | grep master | wc -l`
if [ $num -gt 0 ]
then
echo "nginx is start"
fi;;
"stop" )
$nginx_path -s stop
num=`ps aux | grep nginx | grep master | wc -l`
if [ $num -eq 0 ]
then
echo "nginx is stop"
fi;;
"reload" )
$nginx_path -s reload
echo "nginx is reload";;
esac