在创建目录之前,我只想通过sftp (而不是ssh)检查目录是否存在。到目前为止,我找到的唯一解决方案是使用ssh,但由于权限问题,我只需要使用sftp -有人知道一个方法吗?
sftp_put () {
sftp -oidentityfile=/home/user/.ssh/host_usersftp usersftp@$1 <<EOF
-- Add a check here e.g -- IF exist $2 ( echo $2 exists ) ELSE ( echo create $2 )
mkdir $2
cd $2
put $3
EOF
}https://stackoverflow.com/questions/51437924
复制相似问题