【问题标题】:Error while running expect in unix在 unix 中运行期望时出错
【发布时间】:2017-03-28 19:40:08
【问题描述】:

在 bash 脚本中运行期望脚本时出错

输入:

{

    /usr/bin/expect << EOF

    spawn ssh execsped@10.150.10.194  "cd /home/execsped/ram_test_72;./testecho.sh \"$evenno\" \"$eisinno\" \"$efilename\""

    expect "Password"

    send "abc@123\r"

    expect "*#*"

EOF

}

输出:

extra characters after close-quote

    while executing

"spawn ssh execsped@10.150.10.72 "cd /home/execsped/evoting_test_72;./testecho.sh "10575" "_eVoting.pdf" "abc.pdf"
"

【问题讨论】:

    标签: linux shell unix expect aix


    【解决方案1】:

    删除转义的引号。看看它试图运行的最终命令:"cd /home/execsped/evoting_test_72;./testecho.sh "10575" "_eVoting.pdf" "abc.pdf" " 它应该可以在没有转义引号的情况下运行良好。

    【讨论】:

    • 在执行 "spawn ssh execsped@10.150.10.194 "cd /home/execsped/evoting_test_72;./testecho.sh "10575" "_eVoting.pdf" " abc.pdf"" "
    • 不,我的意思是像这样运行它:spawn ssh execsped@10.150.10.194 "cd /home/execsped/ram_test_72;./testecho.sh $evenno $eisinno $efilename"
    猜你喜欢
    • 1970-01-01
    • 2016-02-14
    • 1970-01-01
    • 2012-11-06
    • 2023-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多