bash - sftp avoid exit when file is not found -


i have script:

filepattern='sor.log*' filepattern2='sor.sor.log*' mylocation=/opt/tradertools/omer clientlocation=/opt/tradertools/omer/sor/from clientname=vmonitorlmpa clientuser=root clientpass=triltest  export sshpass=$clientpass  sshpass -e sftp -ostricthostkeychecking=no -obatchmode=no -b - $clientuser@$clientname << !      $clientlocation/$filepattern2 $mylocation     $clientlocation/$filepattern $mylocation     bye ! 

but if filepattern2 isn't found, exit. how avoid using 2 sftp connections?

quoting sftp man page:

sftp abort if of following commands fail: get, put, reget, reput, rename, ln, rm, mkdir, chdir, ls, lchdir, chmod, chown, chgrp, lpwd, df, symlink, , lmkdir. termination on error can suppressed on command command basis by prefixing command - character (for example, -rm /tmp/blah*).

so use:

-get $clientlocation/$filepattern2 $mylocation 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -