zoukankan      html  css  js  c++  java
  • scp传输文件,自动填充密码

    一个偷懒的小shell,

    #!/usr/bin/expect
    #*************************************************************************
    #         > File Name: expect.sh
    #         > Author: chenglee
    #         > Main : chengkenlee@sina.com
    #         > Blog : http://www.cnblogs.com/chenglee/
    #         > Created Time : 2019年01月30日 星期三 18时16分56秒
    #*************************************************************************
    set user root
    set pass lizhenghua
    set dir /home/newland/filesend
    set ip 192.168.137.176
    set filen [lrange $argv 0 0]
    
    spawn scp ${filen} ${user}@${ip}:${dir}
    expect "${user}@${ip}'s password:"
    send "${pass}
    "
    interact
    

    scp.sh + 要传送的文件

  • 相关阅读:
    打开网页总结
    学期总结
    总结
    Sprint3
    Sprint2团队贡献分
    6.14
    典型用户与场景
    5种创建型模式
    JAVA 将接口的引用指向实现类的对象
    Java里的接口
  • 原文地址:https://www.cnblogs.com/chenglee/p/10337381.html
Copyright © 2011-2022 走看看