读取 ip文件列表 执行脚本
#!/bin/bash
declare hj=$1
echo $hj
function duqu01(){
while :;do
cat /root/wwd/0206/ip_list01|while read m s;do
declare $m
declare $s
echo ‘========’
echo $mastet’asdasdasdasd’
echo $slave’bbbbbbbbbb’
done
#exit 0
done
}
function duqu02(){
echo 02020202
cat ip_list02|while read m s;do
declare $m
declare $s
echo ‘========’
echo ‘master ip’ m a s t e t e c h o ′ s l a v e i p ′ mastet echo 'slave ip' mastetecho′slaveip′slave
done
}
function duqu03(){
cat ip_list03|while read m s;do
declare $m
declare $s
echo ‘========’
echo $mastet’asdasdasdasd’
echo $slave’bbbbbbbbbb’
done
}
if [ “ h j " = " d u q u 01 " ] ∣ ∣ [ " hj" = "duqu01" ]||[ " hj"="duqu01"]∣∣["hj” = “duqu02” ]||[ “$hj” = “duqu03” ]; then
echo “读取参数正常”
else
echo “读取参数不正常”
break
exit 0
fi
echo “+++++++++”
echo h j e c h o " = = = = = = = = = " i f [ " hj echo "=========" if [ " hjecho"========="if["hj" = “duqu01” ];
then
echo “duqu01”
duqu01
elif [ “ h j " = " d u q u 02 " ] ; t h e n d u q u 02 e l i f [ " hj" = "duqu02" ]; then duqu02 elif [ " hj"="duqu02"];thenduqu02elif["hj” = “duqu03” ];
then
duqu03
else
echo “请输入duqu[01…03]”
exit 0
fi