返回值问题

sh/bash/dash/ksh/zsh等Shell脚本
回复
mad_frog
帖子: 55
注册时间: 2011-06-29 11:26

返回值问题

#1

帖子 mad_frog » 2011-07-05 17:17

如下脚本:
/usr/bin/ftp -n $remote_host << EOF
user $remote_user $remote_passwd
binary
prompt
lcd $local_dir_dwonload
cd Update$DATE
mget $down_list
bye
EOF
if [ $? -ne 0 ];then
echo "Download abnormal"
exit
fi
echo "hellp"
当下载遇到错误是自动退出,不再输出hello了,
各位大侠如何实现,我上面的实现不了
头像
lexdene
帖子: 434
注册时间: 2010-02-21 16:19
来自: 大连
联系:

Re: 返回值问题

#2

帖子 lexdene » 2011-07-06 8:35

/usr/bin/ftp
的返回值能代表下载成功失败吗?
mad_frog
帖子: 55
注册时间: 2011-06-29 11:26

Re: 返回值问题

#3

帖子 mad_frog » 2011-07-07 14:10

恩,只要下载有问题就不继续下面的操作了,比如下面还有个echo 就不继续了
头像
lexdene
帖子: 434
注册时间: 2010-02-21 16:19
来自: 大连
联系:

Re: 返回值问题

#4

帖子 lexdene » 2011-07-07 15:25

只能通过其它方式判断下载成功与失败,
而不能通过返回值。
你只能换个别的思路了。
mad_frog
帖子: 55
注册时间: 2011-06-29 11:26

Re: 返回值问题

#5

帖子 mad_frog » 2011-07-08 10:02

lexdene 写了:只能通过其它方式判断下载成功与失败,
而不能通过返回值。
你只能换个别的思路了。


别的就更不知道了,只会这个哦!
头像
lexdene
帖子: 434
注册时间: 2010-02-21 16:19
来自: 大连
联系:

Re: 返回值问题

#6

帖子 lexdene » 2011-07-08 11:47

/usr/bin/ftp
看一下它的man文档,找找有没有有用的东西。
mad_frog
帖子: 55
注册时间: 2011-06-29 11:26

Re: 返回值问题

#7

帖子 mad_frog » 2011-07-08 12:13

这好像和我上面说的没区别吧! :em01
头像
lexdene
帖子: 434
注册时间: 2010-02-21 16:19
来自: 大连
联系:

Re: 返回值问题

#8

帖子 lexdene » 2011-07-08 16:02

除了重定向+文本处理,暂时没有想到太好的方法。
回复