使用bash -c运行ssh时发生意外的EOF错误

时间:2019-08-24 16:04:04

标签: bash

我的bash脚本尝试执行结合ssh和bash的命令,目的是在缺少远程服务器上创建目录。这是完整的命令(我已经更改了实际的密码和IP):

sshpass -p mypasswd ssh -p 22222 root@172.2.3.4 "/bin/bash -c 'if [[ ! -d /var/lib/libvirt/images/ ]]; then mkdir -p /var/lib/libvirt/images/; fi'"

此命令错误如下。知道为什么吗?

[[: -c: line 0: unexpected EOF while looking for matching `''
[[: -c: line 1: syntax error: unexpected end of file

0 个答案:

没有答案