- 论坛徽章:
- 0
|
本帖最后由 tianlang725 于 2017-06-14 16:40 编辑
各位兄弟帮忙看看这个脚本问题出在那里!执行的时候提示错误:
switchchk.sh: line 59: syntax error: unexpected end of file
但是我的脚本只有58行。
# !/bin/sh -x
#
#
#
#
# this is script is get switch table
#
#
#
#
#sw=`cat /home/switch/send/ms.txt | grep 'Revision' |awk -F ',' '{print $2}'`
#
#
# FTp get data from client pc
#
#
#
set user=ope
set password=operator
set smtpHost=192.168.1.47
set from=testerser@hdd.com
cat /home/switch/sw/iplist.txt | grep -v ^$ | while read line
do
echo "$line"
for IpAddress in `awk '{print $2}'`
do
echo "$IpAddress"
done
FTP -n<<EOF
open $IpAddress
user $user $password
ascii
cd /home/ope/lts/system/etc/
lcd /home/switch/sw
get ms.txt
close
bye
EOF
for Testid in `akw '{print $1}'`
do
echo "$Testid"
done
# compare server and client switch tabel
cw=`cat /home/switch/sw/ms.txt | grep 'Revision' | awk -F ',' '{print $2}'`
sw=`cat /home/switch/send/ms.txt | grep 'Revision' |awk -F ',' '{print $2}'`
if [ $sw -eq $cw ];then
echo "$IpAddress":"$Testerid":"$cw":"switch table update" > /home/switch/sw/log_ok
else
echo "$IpAddress":"Testerid":"$cw ":"switch table didnot update" > /home/switch/sw/log_err
echo "This is an automated message.Please do not reply!"
`cat /home/switch/sw/log_err` | mail -s "Please check those client pc !" x_x@163.com.hk
exit
fi
done
|
|