sftp avoid exit when file is not found

前端 未结 1 1575
隐瞒了意图╮
隐瞒了意图╮ 2021-01-13 11:33

I have this script:

filePattern=\'sor.log*\'
filePattern2=\'sor.SOR.log*\'
myLocation=/opt/tradertools/omer
clientLocation=/opt/tradertools/omer/sor/from
cli         


        
1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-13 12:08

    Quoting the sftp man page:

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

    So use:

    -get $clientLocation/$filePattern2 $myLocation
    

    0 讨论(0)
提交回复
热议问题