bash - 使用 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
解决方案
推荐阅读
- reactjs - 可以使用 npm start 启动我的反应应用程序
- x11 - X11 (xorg) 无法设置/更改分辨率 (linux x86)
- java - 我需要 Ubuntu 20 中的 javac 1.6.0_20,我该如何安装它
- python - Python - 使用 t 作为参数和变量的数值积分
- html - 带有可折叠单个项目的侧边栏
- javascript - 自定义使用夹钩,状态问题
- php - Symfony - Gedmo 扩展 - 与关系的蛞蝓
- mysql - 将 MySQL 列约束为 JSON 对象
- r - 生成不是密度的钟形/最佳数据
- spring - Spring 没有拾取 RestController 端点