Quote:
Originally Posted by
penqueen
Yes, I do meant the return code after a FTP command.
so on what basis it returns 226 which in turn means "closing data connection - requested file action successful".
You're missing the point. When you run an
ftp command, it connects to an
ftp server on the target system. When you terminate the
ftp session, the (local)
ftp command will tell the (remote)
ftp server to close the connection.
I haven't looked at the internals of the handshakes between
ftp and the
ftp server. The
ftp server might return a status code to
ftp for each requested operation or it might return a consolidated status code to
ftp when the connection is closed. I would expect the former rather than the latter (and I would expect the
ftp server status code to be used by the
ftp utility use that status code to indicate whether or not each request (e.g.,
get,
mget, or
put) succeeded or failed. Whether or not
ftp sets its exit code based on the server status report(s) isn't specified on the
ftp man page on OS/X (and presumably BSD) systems. I would expect a non-zero exit status from
ftp if the
ftp server reports failure on any (or maybe just on the last) requested operation.
The
ftp utility is not contained in the POSIX standards so I can't give you a specification of what the standards require in this area.