sftp Batchmode command level error suppression does not work?

Boyle, C Brian c.brian.boyle at lmco.com
Thu Feb 25 11:01:49 EST 2010

Hi guys -

OpenSSH sftp  (on solaris)

>From man page

Termination  on  error  can  be suppressed on a command by command basis  by  prefixing the  command  with  a  `-'  character (for example, -rm /tmp/blah* ).

This does not seem to work - instead the server seems to fail to recognize the command from the batchfile.

Consider this batchfile
mkdir tmp
cd tmp
put rpt.list

We want to make sure we have a ./tmp dir - if it exists that's ok
We want the ftp to fail if it can't cd tmp

Run as is (second round)
sftp> mkdir tmp
Couldn't create directory: Failure

(which is expected - directory exists)

Run with -mkdir prefix

sftp> -mkdir tmp
Invalid command.
sftp> cd tmp
sftp> put rpt.list
Uploading rpt.list to /home/bboyle/tmp/rpt.list
sftp> bye

Note, the line -mkdir tmp is not recognized as a command

If I change the script to -mkdir xtmp (new dir)

sftp> -mkdir xtmp
Invalid command.
sftp> cd xtmp
Couldn't canonicalise: No such file or directory

Does not mkdir - ignores the entire command
Cd fails (as we would expect)

Any ideas?

    C. Brian Boyle   PCVM / EWI / HS
[cid:image001.jpg at 01CAB573.0C60AFD0]  [cid:image002.jpg at 01CAB573.0C60AFD0]
                    Enterprise  Business Services

phone   :  303 . 688 . 6008
cell        :  303 . 898 . 5483
email     :  c.brian.boyle at lmco.com<mailto:c.brian.boyle at lmco.com>

More information about the openssh-unix-dev mailing list