shell 循环执行程序问题....
#!/bin/bash
cp /home/guozhiming/Code/V2_Platform/Server/MCU/Mcu ./
cp /home/guozhiming/Code/V2_Platform/Server/MCU/log_options.xml ./
cp /home/guozhiming/Code/V2_Platform/Server/MCU/config.xml ./
cp /home/guozhiming/Code/V2_Platform/Server/C2S/Server/C2S ./
cp /home/guozhiming/Code/V2_Platform/Server/AuthentServer/AuthServer ./
cp /home/guozhiming/Code/V2_Platform/Server/RegUserManager/RegUserServer ./
cmd=("./Mcu" "./C2S" "./AuthServer" "./RegUserServer")
for ((i=0;i<${#cmd[@]};i++))
do
killall ${cmd[$i]}
done
echo "Server is kill ........."
for ((i=0;i<${#cmd[@]};i++))
do
#${cmd[$i]} &
sleep 1
done
echo "Server is start ........"
killall ${cmd[$i]} 不执行应该怎么写多谢....
cp /home/guozhiming/Code/V2_Platform/Server/MCU/Mcu ./
cp /home/guozhiming/Code/V2_Platform/Server/MCU/log_options.xml ./
cp /home/guozhiming/Code/V2_Platform/Server/MCU/config.xml ./
cp /home/guozhiming/Code/V2_Platform/Server/C2S/Server/C2S ./
cp /home/guozhiming/Code/V2_Platform/Server/AuthentServer/AuthServer ./
cp /home/guozhiming/Code/V2_Platform/Server/RegUserManager/RegUserServer ./
cmd=("./Mcu" "./C2S" "./AuthServer" "./RegUserServer")
for ((i=0;i<${#cmd[@]};i++))
do
killall ${cmd[$i]}
done
echo "Server is kill ........."
for ((i=0;i<${#cmd[@]};i++))
do
#${cmd[$i]} &
sleep 1
done
echo "Server is start ........"
killall ${cmd[$i]} 不执行应该怎么写多谢....
作者: ruchong 发布时间: 2011-06-02
本帖最后由 南极雨 于 2011-06-02 17:56 编辑
搞不明白,killall 为什么要用循环呢?
还有 ${#cmd[@]} 看不懂什么意思? 能不能给解释解释?
搞不明白,killall 为什么要用循环呢?
还有 ${#cmd[@]} 看不懂什么意思? 能不能给解释解释?
作者: 南极雨 发布时间: 2011-06-02
没懂你的意思
作者: shplpy 发布时间: 2011-06-02
回复 南极雨
${#cmd[@]} 数组元素数啊
${#cmd[@]} 数组元素数啊
作者: shplpy 发布时间: 2011-06-02
本意 #${cmd[$i]} &循环执行cmd中的程序
killall #${cmd[$i]} 循环kiall cmd中的程序
killall #${cmd[$i]} 循环kiall cmd中的程序
作者: ruchong 发布时间: 2011-06-02
回复 南极雨
Array number
Array number
作者: xiaopan3322 发布时间: 2011-06-02