Hello Alexander,

When put a nonexistent file (fttrant2) with lftp,  the exit command on the put 
command, works fine. The only problem is "$?" Return code variable is 0 ?. Any 
ideas what is wrong, would be very appreciated.

Best regards
Josef

#!/bin/sh
########################################################
# CYG#SFTP (c) J.Berger 2009 September 23 Version 1.0  #
########################################################
ZLINUX_HOST='IP_of_zLinux'                 # z/Linux  host var.
ZLINUX_USER='my_zLinux_userid'          # z/Linux  user var.
#===================================================
echo "ZL#SFTP_FTP Start SSH from unix to z/Linux"
#===================================================
ssh -v "$ZLINUX_USER"@"$ZLINUX_HOST" <<EOF_SSH
lftp -d -u myuser,mypassword IP_of_zLinux
lftp -c "set fail-exit true"
lftp -c "set ssl-allow false"
lftp -c "put -a fttrant2 || exit 1"
lftp -c "put -a fttrant1 || exit 1"
lftp -c "quit"
echo "lftp put return code="$?
EOF_SSH
Exit

Snip of Log:
........
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
put: /home/ftptest/fttrant2: No such file or directory
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
lftp put return code=0
put: Not connected
debug1: channel 0: free: client-session, nchannels 1
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.2 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 0

Reply via email to