Boyle, C Brian
2010-Feb-25 00:01 UTC
sftp Batchmode command level error suppression does not work?
Hi guys - OpenSSH sftp (on solaris)>From man pageTermination 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 bye 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>
Iain Morgan
2010-Feb-25 17:32 UTC
sftp Batchmode command level error suppression does not work?
On Wed, Feb 24, 2010 at 18:01:49 -0600, Boyle, C Brian wrote:> 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 > bye > > 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> > > >Which version of OpenSSH? And are you quite sure it is not Sun's derivative of OpenSSH? Note also that whether -mkdir is recognized or not is a function of the client not of the server. -- Iain Morgan
Reasonably Related Threads
- Problem setting the number of digits in xtable
- Writing tests with Filecheck without emitting output to stdin
- Long to wide format without time variable
- Writing tests with Filecheck without emitting output to stdin
- Writing tests with Filecheck without emitting output to stdin