the usage of linux command "expect"
#! /usr/bin/expect -f
# this script is used to practise the command "expect"
#when "lindex" have been used here, the array index begins with 0 but not with 1
set user [lindex $argv 0]
set host [lindex $argv 1]
set passwd [lindex $argv 2]
set timeout 10
spawn ssh $user@$host
# expect "[yes/no]" {send "yes\r"} if 'ssh-ing' a server for the first time,
# you most likely encounter the case above concerning RSA
expect "password:" {send "$passwd\r"}
interact
# modify the script mode to be 0744
# now, one runs "./login.exp your_name host_name your_passwd" in the bash shell, logging in the server successfully.
the usage of linux command "expect"的更多相关文章
- 15 Examples To Master Linux Command Line History
When you are using Linux command line frequently, using the history effectively can be a major produ ...
- 10 Interesting Linux Command Line Tricks and Tips Worth Knowing
I passionately enjoy working with commands as they offer more control over a Linux system than GUIs( ...
- 5 commands to check memory usage on Linux
Memory Usage On linux, there are commands for almost everything, because the gui might not be always ...
- [笔记]The Linux command line
Notes on The Linux Command Line (by W. E. Shotts Jr.) edited by Gopher 感觉博客园是不是搞了什么CSS在里头--在博客园显示效果挺 ...
- A Complete Guide to Usage of ‘usermod’ command– 15 Practical Examples with Screenshots
https://www.tecmint.com/usermod-command-examples/ -------------------------------------------------- ...
- linux command lynx
[Purpose] Learning linux command lynx [Eevironment] Ubuntu 16.04 terminal apt-get ...
- Linux command find All In One
Linux command find All In One $ find -h # find: illegal option -- h # usage: # find [-H | -L | -P] [ ...
- linux tcl expect 安装(转)
linux tcl expect 安装 一.Tcl安装 1. 下载:tcl8.4.20-src.tar.gz http://www.tcl.tk/software/tcltk/downloadnow ...
- 《The Linux Command Line》 读书笔记04 Linux用户以及权限相关命令
Linux用户以及权限相关命令 查看身份 id:Display user identity. 这个命令的输出会显示uid,gid和用户所属的组. uid即user ID,这是账户创建时被赋予的. gi ...
随机推荐
- hive 函数 Cube
最近在优化一个报表系统.leader 提示我可以用cube函数.在此记录一下使用: 1) cube 简称数据魔方. 可以实现hive多个任意维度的查询. cube(a,b,c) 首先会对(a,b,c ...
- IE/FF/Chrome下document.documentElement和document.body的 scrollHeight/scrollTop/clientHeight
IEdocument.documentElement.scrollHeight 浏览器所有内容高度 ,document.body.scrollHeight 浏览器所有内容高度document.do ...
- jQuery 效果 - 隐藏和显示
$('...').hide();//隐藏 $('...').show();//显示 以上使用需要针对特定的功能单独使用,如果是混用,那么就要有标志位去实现,而通常两者更高级的一步到位实现: $('.. ...
- Jenkins配置MSBuild时使用环境变量
[MSBuild Plugin]插件在使用环境变量有个很奇葩的方式,比如我们通常在Windows的节点机器上,使用WORKSPACE环境变量时,批处理应该这样写%WORKSPACE%,而有时插件确不能 ...
- C#的参数修饰符out,params,ref
using System; namespace ParamsProgram { class TestParams { public static void Main(string[] args)//s ...
- POJ 2976 Dropping tests(最大化平均值 or 01整数规划)
题目链接 忽略运算符逻辑导致奇怪的错误(代码中指明位置了) 输出没加0.5,WA. 还有,注意特殊情况k=0,所以scanf("%d%d", &n, &k)& ...
- hihocoder 1356 分隔相同整数
时间限制:10000ms单点时限:1000ms内存限制:256MB 描述 给定一个包含N个整数的数组A.你的任务是将A重新排列,使得任意两个相等的整数在数组中都不相邻. 如果存在多个重排后的数组满足条 ...
- [JavaEE]理解ThreadLocal
转http://www.iteye.com/topic/103804 首先,ThreadLocal 不是用来解决共享对象的多线程访问问题的,一般情况下,通过ThreadLocal.set() 到线程中 ...
- 如何判断ios设备中是否安装了某款应用
URL Schemes关键字研究一下即可 常见得URL Schemes见http://www.cnblogs.com/huangzs/p/4491286.html if ([[UIApplicatio ...
- 机器学习笔记—Logistic回归
本文申明:本系列笔记全部为原创内容,如有转载请申明原地址出处.谢谢 序言:what is logistic regression? Logistics 一词表示adj.逻辑的;[军]后勤学的n.[逻] ...