Wondering what are some of the right ways to check whether File Transfer Protocol (FTP) succeeded or not inside the KornShell (ksh) script.
相关问题
- How to get the return code of a shell script in lu
- Invoking Mirth Connect CLI with Powershell script
- Why should we check WIFEXITED after wait in order
- Emacs shell: save commit message
- “command not found” errors in expect script execut
相关文章
- 使用2台跳板机的情况下如何使用scp传文件
- In IntelliJ IDEA, how can I create a key binding t
- shell中反引号 `` 赋值变量问题
- How get the time in milliseconds in FreeBSD?
- Making new files automatically executable?
- Reverse four length of letters with sed in unix
- Launch interactive SSH bash session from PHP
- Generate disk usage graphs/charts with CLI only to
There are so many ftp-clients AND many of there do not necessarily follow std return conventions that you have to do some simple tests, and then code accordingly.
If you're lucky, your ftp-client does return std exit codes and they are documented via
man ftp
(You do know about man pages?). In that case, 0 means success and any non-zero indicates some sort of problem, so the very easiest solution is something like( not quite sure that the
ftp user@remoteHost file remoteDir
is exactly right, (I don't have access to a client right now and haven't used ftp in years (shouldn't you be using sftp!? ;-) ) but I use the same in both examples to be consistent).You probably want a little more control, so you need to capture the return code.
I'm not certain about the meaning of 1 or 2, these are meant to be illustrative only. Look at your
man ftp
to see if they are documented, OR do a simple test where deliberately give one error at a time to ftp to see how it is responding.If std error codes are not used or are inconsistent, then you have to capture the ftp output and examine it to determine status, something like
I hope this helps.