1 #!/usr/bin/expect 2 set timeout 100 3 set passwd "your password" 4 spawn shell 5 expect "key" 6 send "$passwd\n" 7 interact 第一行主要用于指明expect执行路径,由于登录... ...
分类:
其他好文 时间:
2017-03-09 11:58:58
阅读次数:
144
subprocess意在替代其他几个老的模块或者函数,比如: os.system、os.spawn、os.popen、commands。 call执行命令,返回状态码 check_call 执行命令,状态码为0返回0,否则抛出异常。 check_output 如果状态码为0,返回执行后结果,如果状态 ...
分类:
编程语言 时间:
2017-02-07 10:52:24
阅读次数:
267
shell脚本实现ssh自动登录远程服务器示例: #!/usr/bin/expect spawn ssh root@192.168.22.194 expect "*password:" send "123\r" expect "*#" interact 原文链接:http://www.xuanhao ...
分类:
其他好文 时间:
2017-01-20 11:07:10
阅读次数:
195
1 #!/usr/bin/expect 2 set timeout 10 3 spawn ssh root@20.0.102.19 4 expect "password:" 5 send "123456\n" 6 interact 1 #!/usr/bin/expect 2 set timeout ... ...
分类:
其他好文 时间:
2017-01-16 21:22:19
阅读次数:
159
expect的核心是spawn expect send set spawn:spawn是进入expect环境后才可以执行的expect内部命令,相当于shell中的内置命令,通过它,调用需要执行的命令 expect:捕获提示 send:发送交互值(结尾需要加上\n) set:设置变量 interac ...
分类:
系统相关 时间:
2017-01-04 22:56:42
阅读次数:
299
Child Process child_process 这个模块可以生成一个子进程。nodejs提供了好几个API,本质上都是调用child_process.spawn(): 1 const spawn = require('child_process').spawn; 2 const ls = s ...
分类:
其他好文 时间:
2016-12-24 01:56:13
阅读次数:
175
#!/usr/bin/expect#!/bin/bashforNUMin{1..10}doping-c1-w1172.25.254.$NUM&>/dev/null&&(/mnt/ssh.exp172.25.254.$NUMredhathostname|grep-E"^The|ECDSA|connecting|Warning|password|spawn"-v|sed"s/Permission\denied\,\please\try\again\./172.25.254.$NUMp..
分类:
其他好文 时间:
2016-12-16 01:52:53
阅读次数:
193
#!/usr/bin/expect-fsetip[lindex$argv0]setpasswd[lindex$argv1]setpath[lindex$argv2]setfile[lindex$argv3]setcmd[lindex$argv2]spawnscp$filepasswordusernameroot@${ip}:$pathexpect"password:*"send"${passwd}\r"spawn/usr/bin/sshroot@${ip}expect"password:"send"${pas..
分类:
其他好文 时间:
2016-12-15 18:24:02
阅读次数:
140
1 环境 2 错误 3 解决 4 参考 环境 错误 TortoiseGit 客户端 push时报 git.exe push --progress "origin" master:master error: cannot spawn sh: No such file or directoryerror ...
分类:
其他好文 时间:
2016-12-11 03:07:16
阅读次数:
378
HOW TO USE MPS ON SINGLE GPU ? No application modifications necessary ? Proxy process between user processes and GPU ? MPS control daemon ? Spawn MPS ...
分类:
其他好文 时间:
2016-12-05 23:22:09
阅读次数:
170