shell脚本ftp自动上传文件验证成功与否

来源:互联网 发布:手机端淘宝店铺模板 编辑:程序博客网 时间:2024/05/17 01:54
#!/bin/bash
exec 6>&1
exec > /tmp/txt
ftp -nv 192.168.1.254<<!
user harry redhat
cd pub
lcd /etc
put passwd
close
bye
!

exec 1>&6
exec 6>&-
if grep -q "Transfer complete" /tmp/txt;then
echo "success!"
else
echo "failure!"
fi