bash – sftp避免在找不到文件时退出
发布时间:2020-12-15 21:18:39 所属栏目:安全 来源:网络整理
导读:我有这个脚本: filePattern='sor.log*'filePattern2='sor.SOR.log*'myLocation=/opt/tradertools/omerclientLocation=/opt/tradertools/omer/sor/fromclientName=vmonitorlmpaclientUser=rootclientPass=triltestexport SSHPASS=$clientPasssshpass -e sftp
我有这个脚本:
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 << ! get $clientLocation/$filePattern2 $myLocation get $clientLocation/$filePattern $myLocation bye ! 但是如果找不到filepattern2,它将退出.如何避免使用两个SFTP连接? 解决方法
引用
sftp man page:
所以使用: -get $clientLocation/$filePattern2 $myLocation (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |