关闭报价后会出现额外的字符

时间:2017-12-01 09:01:18

标签: ubuntu unix ssh gitlab-ci gitlab-ci-runner

我收到错误

extra characters after close-quote
    while executing
"spawn ssh-add <(echo -e "-----BEGIN RSA PRIVATE KEY-----
 Proc-Type: 4,ENCRYPTED
 DEK-Info: AES-128-CBC,2AB77A7C6E344A120BA00670A3CAB833

 AM57TuHYLo..."

使用expect和spawn添加带密码的ssh密钥时。 这是我的剧本:

eval $(ssh-agent -s)
expect -c "spawn ssh-add <(echo -e \"$SSH_PRIVATE_KEY\\r\"); expect \"Enter passphrase\"; send \"$SSH_PASSPHRASE\\r\"; expect eof;"

在回显ssh私钥时我也尝试了很多组合:

echo "$SSH_PRIVATE_KEY"
echo \"$SSH_PRIVATE_KEY\"
echo -e \"$SSH_PRIVATE_KEY\"
echo '$SSH_PRIVATE_KEY'
echo '$SSH_PRIVATE_KEY'

0 个答案:

没有答案