使用shell数组重启tomcat

#!/bin/bash
tomcat1="/usr/local/tomcat1/"
tomcat2="/usr/local/tomcat2/"
tomcat3="/usr/local/tomcat3/"
tomcat4="/usr/local/tomcat4/"
tomcat=($tomcat1 $tomcat2 $tomcat3 $tomcat4)
#for((i=0;i<${#tomcat[@]};i++));do
#       ${tomcat[$i]}bin/shutdown.sh >> /dev/null 2>&1
#       sleep 2
#       ${tomcat[$i]}bin/startup.sh  >> /dev/null 2>&1
#       echo ${tomcat[$i]} restart OK
#done
#array
echo ${tomcat[@]}
echo ${tomcat[@]:1}
echo ${tomcat[@]:0:2}
echo ${tomcat[@]:0:1}
echo ${tomcat[@]:1:2}
echo ${tomcat[@]:1:3}
exit
#array Len
echo ${#tomcat[*]}
echo ${#tomcat[@]}
#Del array
unset tomcat[0]
echo ${tomcat[@]}
unset tomcat
echo ${tomcat[@]}

你可能感兴趣的:(重启tomcat,shell数组)