您的位置:首页 > 编程语言 > PHP开发

判断ftp是否登录成功

2016-04-11 15:14 399 查看
在shell 中 不能直接打印出ftp链接失败的日志,可通过以下方式间接实现:

#判断FTP登陆是否成功
#!/bin/sh
ftp -i -n 10.87.25.221 2>&1>output.txt <<EOF
user jyfx jyfx 
bye
EOF

rCount=`cat output.txt|wc -l`
echo $rCount
if [ $rCount -gt 0 ]
then
echo "Login Fail"
fi
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  shell