shell expect简单用法

简介: #!/usr/bin/expect -fspawn ssh-keygen -t rsaexpect "*(/root/.ssh/id_rsa):"send "\r"expect "*(empty for no passphrase):"sen...

#!/usr/bin/expect -f

spawn ssh-keygen -t rsa

expect "*(/root/.ssh/id_rsa):"

send "\r"

expect "*(empty for no passphrase):"

send "\r"

expect "*passphrase again:"

send "\r"

expect eof

spawn ssh-copy-id root@172.16.53.22

expect "*connecting (yes/no)?"

  send "yes\r"

  expect "*password:"

  send "yjy9H,jChdm\r"

  expect eof

目录
相关文章
|
18天前
|
存储 运维 Shell
shell中for while until 三种循环的用法
shell编程中,有几种常见的循环结构,包括for循环、while循环和until循环,总的来说,循环shell编程中扮演着至关重要的角色,它们使得自动化任务变得更加容易,提高了效率,并且可以处理各种各样的编程需求。
shell中for while until 三种循环的用法
|
6月前
|
存储 Shell Linux
Shell 编程:探索 Shell 的基本概念与用法
Shell 是一个用 C 语言编写的程序,它是用户使用 Linux 的桥梁。Shell 既是一种命令语言,又是一种程序设计语言。 Shell 是指一种应用程序,这个应用程序提供了一个界面,用户通过这个界面访问操作系统内核的服务。 Shell 脚本(shell script),是一种为 shell 编写的脚本程序,shell 和 shell script 是两个不同的概念。
84 0
|
6月前
|
监控 Shell Linux
Linux Shell高级用法:优化和自动化你的工作流程
Linux Shell是一个非常强大的工具,可以用于自动化任务、处理文本和数据、进行系统管理等。在这篇文章中,我们将介绍一些Linux Shell的高级用法,帮助你更高效地利用Shell完成各种任务。
99 0
|
18天前
|
Shell Perl
shell学习(九) 【shell sed用法】
shell学习(九) 【shell sed用法】
9 0
|
1月前
|
Shell C语言 C++
【Shell 编程指南】shell中的(),{}几种语法用法
【Shell 编程指南】shell中的(),{}几种语法用法
17 0
|
2月前
|
Shell
shell脚本for循环复杂用法
shell脚本for循环复杂用法
47 5
|
2月前
|
存储 Shell Linux
Linux的shell命令——变量用法
Linux的shell命令——变量用法
32 0
|
8月前
|
运维 Shell Python
【运维知识高级篇】超详细的Shell编程讲解2(变量切片+统计变量长度+字串删除+字串替换+七种方法进行数值运算+整数比较+多整数比较+文件判断+字符串比对+正则比对+配合三剑客的高阶用法)(一)
【运维知识高级篇】超详细的Shell编程讲解2(变量切片+统计变量长度+字串删除+字串替换+七种方法进行数值运算+整数比较+多整数比较+文件判断+字符串比对+正则比对+配合三剑客的高阶用法)
91 0
|
4月前
|
NoSQL Shell 数据安全/隐私保护
搞定shell脚本expect自动化交互输入密码等就是这么简单
搞定shell脚本expect自动化交互输入密码等就是这么简单
169 0
|
6月前
|
Shell 容器
SAP UI5 的 Unified Shell 发展历史和用法介绍试读版
SAP UI5 的 Unified Shell 发展历史和用法介绍试读版
32 0
SAP UI5 的 Unified Shell 发展历史和用法介绍试读版