Code: Select all
if [ "$1" = "-at" -o "$1" = "-rt" ];then ### Test Mode
echo ""
echo "$newDHCP"
elif [ "$1" = "-a" -o "$1" = "-r" ];then ### Run Mode
echo ""
echo " The dhcpd.conf file has been modified."
echo "$newDHCP" > $pathDHCP
elif [ "$1" = "-l" ];then ### List Hosts
i=11
while :
do
MAC=`sed -n "/host PUP-$i/{n;p;}" /etc/dhcp3/dhcpd.conf`
if [ -z "$MAC" ];then
break
else
echo "PUP-$i "`echo $MAC | cut -d " " -f 3 | cut -d ";" -f 1`
fi
i=`expr $i + 1`
done
else ### Error
echo ""
echo " ERROR: Input error!"
fi
The second elif statement "elif [ "$1" = "-l" ];then" has "-l" that won't work.
I tried changing it to "-d" & it works just fine!
In using "-l" as an argument to a Bash script, have I uncovered some kind of gotcha?