expect

linux + ssh limitation + ssh at the same time from multiple machine to one machine

牧云@^-^@ 提交于 2019-12-23 03:27:14
问题 the following script "testssh.ksh" proves that ssh have some problems when we try to perform ssh from multiple machines on the same time in fact the target of this script is to verify the file test_file under /var/tmp in the Solaris server (10.10.18.6) , as all see in some ssh steps we can’t verify the existing of the test_file because ssh stuck or not activate from the expect background - this script perform 15 times ssh to Solaris server with IP - 10.10.18.6 on the same time in order to

Why does automating SFTP with Expect hang after sending the password?

痴心易碎 提交于 2019-12-23 02:52:53
问题 I am attempting to automate uploading some files from my Linux server to an FTP-enabled Windows server. I am successfully doing so manually using SFTP and then issuing the put command. However, when called from cron, my script keeps stopping for a password. Below is the code I am attempting to use: #!/usr/bin/expect #!/bin/sh clear spawn sftp remoteuser@43.123.0.10 expect "password" send "world" expect eof As it stands, it stops each time to request a password. Why doesn't send "world"

automating install.sh script using an expect script

时间秒杀一切 提交于 2019-12-23 02:06:07
问题 I have a bit of a quandary that I can't seem to figure out, and i'm sure it's easy.. I have an external shell script, we will call it "install.sh" that is used to install a piece of software that our company develops. I want to automate that install.sh process using expect (with external arguments), since it's pretty easy to pattern match on the output strings and pass in a bunch of arguments, either as an array or arguments to the expect script. Unfortunately, many of the examples online are

Automating xterm using Expect

半腔热情 提交于 2019-12-22 13:05:15
问题 I am trying to automate xterm window using Expect (though I already knew Expect cant control such GUI applications, but there is a tweaked mechanism explained in Exploring Expect) package require Expect spawn -pty stty raw -echo < $spawn_out(slave,name) regexp ".*(.)(.)" $spawn_out(slave,name) dummy c1 c2 if {[string compare $c1 "/"] == 0} { set c1 "0" } set xterm_pid [exec xterm -S$c1$c2$spawn_out(slave,fd) &] close -slave expect "\n" ;# match and discard X window id set xterm $spawn_id

How can I use Expect to enter a password for a Perl script?

眉间皱痕 提交于 2019-12-21 16:59:40
问题 I wish to automatically enter a password while running an install script. I have invoked the install script using the backticks in Perl. Now my issue is how do I enter that password using expect or something else? my $op = `install.sh -f my_conf -p my_ip -s my_server`; When the above is executed, a password line is printed: Enter password for the packagekey: In the above line I wish to enter the password. 回答1: use Expect.pm. This module is especially tailored for programatic control of

3o_AutoSSH

不问归期 提交于 2019-12-21 07:05:46
∮自动发送 ssh 公钥,为 ansible 鸣锣开道 Bold 参考资料 http://mageedu.blog.51cto.com/4265610/1412028 ...其实我并没有参考这篇博文的很多东西,只是我不太想解释我在做什么.... ...我在做的其实是 使ansible 的被管理主机实现通过脚本发送 ssh 公钥,使其可以基于 ssh 进行互信通信 之前对 ssh 的理解稍有偏差,我在这里直接说正确的理解就好了. A 连接 B (A,B 是两台机器,跑着 Linux CentOS7 的机器),B 是SSH 服务器,A 是客户端. 客户端需要把 自己的公钥发送至 服务器.以实现无需验证的 ssh 登陆.B 需要一直监听在 TCP22 端口. A 是客户端,但 A 也是 ansible 的管理端, B 是众多被管理的 小弟之中的一个... "小弟"之中的一个.但 B 是 SSH 的服务器端. 其实我下面要说的 和 ansible 就没啥关系... 我直接上脚本吧... . ~之前还要做一件事 #yum install expect 嗯嗯,一般来讲,expect 是另一种脚本,第一行得指明解释器的位置, man文档里说的比较清楚 # man expect 人家说 确保 #!/usr/bin/expect -f 在程序的第一行 ,不过人家是用英语说的... 但是我用 EOF流

How to access environment variables in an Expect script?

久未见 提交于 2019-12-20 16:16:17
问题 I would like to access the PATH environment variable inside an expect script. How can I achieve that ? My actual script is : #!/usr/bin/expect set timeout 300 send "echo $PATH\r" and its ouput is : can't read "PATH": no such variable while executing "send "echo $PATH\r"" 回答1: Expect is an extension of Tcl. Tcl access enviroment variables via the global env array: send_user "$env(PATH)\n" 回答2: You can use the global env array by using: $::env(PATH) This notion will also work inside procedures.

jest enzyme unit test react

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 15:20:02
1. 测试类型 单元测试:指的是以原件的单元为单位,对软件进行测试。单元可以是一个函数,也可以是一个模块或一个组件,基本特征就是只要输入不变,必定返回同样的输出。一个软件越容易些单元测试,就表明它的模块化结构越好,给模块之间的耦合越弱。React的组件化和函数式编程,天生适合进行单元测试 功能测试:相当于是黑盒测试,测试者不了解程序的内部情况,不需要具备编程语言的专门知识,只知道程序的输入、输出和功能,从用户的角度针对软件界面、功能和外部结构进行测试,不考虑内部的逻辑 集成测试:在单元测试的基础上,将所有模块按照设计要求组装成子系统或者系统,进行测试 冒烟测试:在正式全面的测试之前,对主要功能进行的与测试,确认主要功能是否满足需要,软件是否能正常运行 2. 开发模式 TDD: 测试驱动开发,英文为Testing Driven Development,强调的是一种开发方式,以测试来驱动整个项目,即先根据接口完成测试编写,然后在完成功能是要不断通过测试,最终目的是通过所有测试 BDD: 行为驱动测试,英文为Behavior Driven Development,强调的是写测试的风格,即测试要写的像自然语言,让项目的各个成员甚至产品都能看懂测试,甚至编写测试 TDD和BDD有各自的使用场景,BDD一般偏向于系统功能和业务逻辑的自动化测试设计

What is the difference between spawn and exec?

风格不统一 提交于 2019-12-20 10:37:53
问题 I'm learning to write a TCL (expect) scripts and I notice that some examples show to use spawn, while others show the command exec. I tried googling, but can't find what is the difference? Suppose I call 'exec' in a middle of a long expect script, what can I expect to happen? 回答1: spawn is an expect command not a tcl command. exec is a tcl command. spawn creates a process. The processes' input and output are connected to expect for use by the other expect commands: send , expect and interact

Expect: No such variable [closed]

我是研究僧i 提交于 2019-12-20 05:54:52
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I started using expect. I have a simple script. But I have a problem. I want to init a variable which has a $ an first character: set mystring "$THIS_IS_MY_STRING%" So I get an error, because expect expects a variable. How can I fix this? 回答1: Escape any special characters such as the dollar sign by proceeding