RETVAL=0
oper(){
if [ "$1" == "del" ];then
list=echo{10..1}
else
list=echo{1..10}
fi
for ip in $list;do
if [ $ip -eq 5 ];then
continue
fi
ip addr $1 192.168.1.$ip/14 dev eth0 label eth0:$ip &>/dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ];then
action "$1 $ip" /bin/true
else
action "$1 $ip" /bin/false
fi
done
return $RETVAL
}
case "$1" in start) oper add RETVAL=$? ;; stop) oper del RETVAL=$? ;; restart) oper del sleep 2 oper add RETVAL=$? ;; *) printf "USAGE:$0 {start|stop|restart}\n" esac exit $RETVAL