I have written below code to get listing from a remote server. echo set xfer:log yes > batchfile.txtecho set xfer:log-file Templogfile1.txt>> batchfile.txtecho open -p $rport -u $ruser,$rpass sftp://$ripaddress>> batchfile.txtecho cache flush>> batchfile.txtecho cd $rrdir>> batchfile.txtecho pwd>> batchfile.txtecho ls -l $srfile>> batchfile.txtecho quit>> batchfile.txtexec 3>&1 4>&2                 exec > TempSessionLog.txt 2>&1 set -x                         (   lftp -f batchfile.txt >TempLogFile.log <<- EndFTP   EndFTP)  retval1=$? exec 1>&3 2>&4   set +x         I have passed an incorrect directory name. A standard sftp returns error code ($? != 0) but lftp sends a success (retval1 = 0) return code. In the TempSessionLogFile above, I see the error message cd: Access failed: No such file (<<Directory Path>>) with a successful return value.Is there a way to capture the errors in lftp on the return codes? If not, what are my alternatives?
lftp return code
shell script;ksh;sftp;return status;lftp