On Mon, 28 Apr 2008, Bond Masuda wrote:

> I recently had to do some scripting around OpenSSH's version of sftp and
> noticed that the exit codes don't seem to be documented anywhere (of course,
> outside the source code that is). Does anyone know where I can find a list
> of exit codes for the sftp program and what each one means?


Just 1 or 0.

> I'm actually porting a shell script that use to use SSH Communications's
> version of sftp2, which has a list of documented exit codes and the script
> handles the exit codes based on their meaning. By trial and error, I've
> figured out that OpenSSH's sftp returns '1' for the situation I was fixing,
> but I want to make sure it handles all conditions/exit codes appropriately.
>
> Any pointers to information would be appreciated (documentation or specific
> source file or ?). Thanks!


See sftp.c (and sftp-client.c).
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/

I don't think sftp (or even scp) do what you want.

Jeremy C. Reed