美文网首页
expect实现远程copy

expect实现远程copy

作者: 词画人间 | 来源:发表于2019-05-05 17:58 被阅读0次

    #!/usr/bin/expect

    set timeout 10

    set host "IP地址"

    set username "username"

    set password "password"

    set path "需要拷贝的文件路径"

    set pathlocal "本地文件路径"

    spawn scp $username@$host:$path $pathlocal

    expect {

    "(yes/no)?"

    {

    send "yes\n"

    expect "*password:" { send "$password\n"}

    }

    "*password:"

    {

    send "$password\n"

    }

    }

    expect "100%"

    expect eof

    相关文章

      网友评论

          本文标题:expect实现远程copy

          本文链接:https://www.haomeiwen.com/subject/mmghoqtx.html