首页 > 解决方案 > 使用 SFTP 命令检查远程服务器上的现有目录

问题描述

我正在尝试检查远程服务器上的现有目录。我正在使用下面的代码进行检查,但不知何故它似乎无法正常工作。您的帮助将不胜感激。

sftp -o "IdentityFile=${sftpkey}" ${sftpaccount}@${sftphost} [:dir [$pocOutbound]] <<EOF >/dev/null 2>&1
cd "${pocOutbound}" 
bye
EOF

if [ $? -ne 0 ]
then   
logmsg "folder does not exist"   
exit 2
fi

标签: bash

解决方案


推荐阅读