My script work on Linux but not work in sun os.
my script.
logFiles="sentLog1.log sentLog2.log"
intial_time="0 0"
logLocation="/usr/local/tomcat/logs/"
sleepTime=600
failMessage=":: $(tput bold)Log not update$(tput rmso) = "
successMessage="OK"
arr=($logFiles)
time_arr=($intial_time)
arrlen=${#arr[@]}
arrcount=()
date
for count=0; count<arrlen; count++ ; do
arrcount[$count]=`ls -l $logLocation${arr[$count]} |awk '{print $5}'`
echo "${arr[$count]} Original size :: ${arrcount[$count]}"
done
echo
while [ "e" == "e" ] ; do
sleep $sleepTime
date
for ((count=0; count<arrlen; count++)) ; do
nc=`ls -l $logLocation${arr[$count]} |awk '{print $5}'`
echo -n "${arr[$count]} "
if [ $nc == ${arrcount[$count]} ] ; then
time_arr[$count]=`echo ${time_arr[$count]} + 10 | bc`
echo $failMessage " " ${time_arr[$count]} " Minute."
else
arrcount[$count]=$nc
echo $successMessage
time_arr[$count]=0
fi
done
echo
echo
echo
echo
done
run on linux it ok. but run on sun os it not ok.
output of sun os.
Wed Jan 30 17:08:28 USA 2013
./MonSellVASMDB.sh: line 18: syntax error near unexpected token `(('
./MonSellVASMDB.sh: line 18: `for ((count=0; count<arrlen; count++)) ; do'