In some cases scp exits with 0 (SUCCESS), yet there was no success. This is always while connecting to the remote host. For example: # scp unknown_host:file . ssh: unknown_host: no address associated with hostname. # echo $? 0 # scp host_is_down:file . Secure connection to no_sshd_on_host refused. # echo $? 0 # scp no_sshd_on_host:file . Secure connection to no_sshd_on_host refused. # echo $? 0 Problems during data transfer (no existing files or permission problems) deliver the correct error code. I'm using OpenSSH-2.5.1 on IRIX6.5. I think it's a bug in scp. Can someone agree? Andreas
