簡單的Shell指令碼
#! /bin/bash xzh=“/1/2/3/4” if [ ! -e $xzh ] then mkdir -p $xzh fi
#!/bin/bash read -p “please set file:” n if[ ! -e $n ] then touch $n fi
#!/bin/bash
n=cat iplist
for IP in $n
do
ping -c 3 -i 0.2 -w 3 $IP &> /dev/null
if [ $? -eq 0 ] ; then
echo “Host $IP is on-line.”
else
echo “Host $IP is off-line.”
fi
done
#!/bin/bash read -p “please set directory:” n if [ ! -e $n ] then mkdir -p $n else echo “this $n directory exist” fi
read -p “Enter your score (0-100) : " GRADE if [ $GRADE -ge 85 ] && [ GRADE is Excellent” elif [ $GRADE -ge 70 ] && [ GRADE is Pass" elif [ $GRADE -gt 100 ] || [ GRADE is does not exist" else echo “$GRADE is FAil” fi
#!/bin/bash read -p " Enter a name : " n if [ -e $n ] && [ -d n is directory" elif [ -e $n ] && [ -f n is file" else echo “$n is does not exist” fi
#!/bin/bash
read -p “Enter The Users Password : " n
for u in cat forlist
do
id $u &> /dev/null
if [ $? -eq 0 ]
then
echo “Already exists”
else
useradd $u N” | passwd --stdin $u &> /dev/null
if [ u ,Create success"
else
echo “$u ,Create failure”
fi
fi
done