首页 > 其他 > 详细

expect 实现模拟交互

时间:2020-04-29 20:15:56      阅读:54      评论:0      收藏:0      [点我收藏+]

expect 实现模拟交互

expect安装

apt install expect

server

#! /bin/bash
read -p "username: " username
read -sp "password: " password
echo -en "\n" # echo 
echo $username, $password

client

#! /usr/bin/expect
spawn ./server.sh
expect "username: "
send "foo\n"
expect "password: "
send "bar\n"
interact

运行方法

./client.sh

expect 实现模拟交互

原文:https://www.cnblogs.com/pkuimyy/p/12804221.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!