Dony Pierre wrote:
> We want to use sftp in batch and we have a problem with the return code
> openssh sftp retuns. If for example, you try to get/pit a file that does
> not exist, you will receive a rc = 0.
>
> We have tested sftp -b test.txt -oBatchMode=yes donypie@10.33.2.142
> 2>debug.log
>
> and then analyze debug.log with a perl BUT it will be a lot of work !.
>
> Does anybody know how we can resolve this problem ?


What OpenSSH version is this, and what's the content of "test.txt"?
Current version seems to behave OK.

$ cat test.txt
put nosuch /tmp/tmp2
$ sftp -b test.txt -obatchmode=yes localhost
sftp> put nosuch /tmp/tmp2
File "nosuch" not found.
$ echo $?
1

--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.