[root@master1-192-168-117-18 ~]# vim mkcdrom.sh
創(chuàng)新互聯(lián)建站堅持“要么做到,要么別承諾”的工作理念,服務領域包括:成都網站建設、網站建設、企業(yè)官網、英文網站、手機端網站、網站推廣等服務,滿足客戶于互聯(lián)網時代的龍沙網站設計、移動媒體設計的需求,幫助企業(yè)找到有效的互聯(lián)網解決方案。努力成為您成熟可靠的網絡建設合作伙伴!
#!/bin/bash
DIR="/media/cdrom"
if [ ! -e $DIR ]
then
mkdir -p $DIR
fi
[root@master1-192-168-117-18 ~]# vim chkhost.sh
#!/bin/bash
ping -c 3 -i 0.2 -W 3 $1 &> /dev/null
if [ $? -eq 0 ]
then
echo "Host $1 is on-line"
else
echo "Host $1 is off-line"
fi
[root@master1-192-168-117-18 ~]# bash chkhost.sh 192.168.1.11
Host 192.168.1.11 is on-line
注釋:-c參數(shù)來規(guī)定嘗試的次數(shù),并使用-i參數(shù)定義每個數(shù)據包的發(fā)送間隔,以及使用-W參數(shù)定義等待超時時間
[root@master1-192-168-117-18 ~]# vim chkscore.sh
#!/bin/bash
read -p "Enter your score (0-100) :" GRADE
if [ $GRADE -gt 100 ];
then
echo "$GRADE is Error"
elif [ $GRADE -ge 85 ] && [ $GRADE -le 100 ];
then
echo "$GRADE is Excellent"
elif [ $GRADE -ge 70 ] && [ $GRADE -le 84 ];
then
echo "$GRADE is Pass"
else
echo "$GRADE is Fail"
fi
[root@master1-192-168-117-18 ~]# bash chkscore.sh
Enter your score (0-100) :200
200 is Error
[root@master1-192-168-117-18 ~]# bash chkscore.sh
Enter your score (0-100) :93
93 is Excellent
[root@master1-192-168-117-18 ~]# bash chkscore.sh
Enter your score (0-100) :80
80 is Pass
[root@master1-192-168-117-18 ~]# bash chkscore.sh
Enter your score (0-100) :23
23 is Fail