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 ...
随机推荐
- [cf140e]New Year Garland
Description 用$m$种颜色的彩球装点$n$层的圣诞树.圣诞树的第$i$层恰由$l[i]$个彩球串成一行,且同一层内的相邻彩球颜色不同,同时相邻两层所使用彩球的颜色集合不同. 求有多少种装点 ...
- Leetcode 113. Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...
- 【BZOJ-2286】消耗战 虚树 + 树形DP
2286: [Sdoi2011消耗战 Time Limit: 20 Sec Memory Limit: 512 MBSubmit: 2120 Solved: 752[Submit][Status] ...
- codeforces 723E:One-Way Reform
Description There are n cities and m two-way roads in Berland, each road connects two cities. It is ...
- hdu5047 找规律+欧拉公式
题意:在一个正方形内画n个M,求最多能分成多少个平面 sol:这种求划分成多少个平面的题第一反应肯定是欧拉公式: 二维平面上的欧拉公式:V+F-E=1 (V:Vertices,F:Faces,E:Ed ...
- 如何保持自己 fork 的项目和原始项目同步
首先先通过 github 的 web 页面 fork 目标的项目 前提是自己已经设置好了git,并且配置了相应的权限 然后使用git clone命令在本地克隆自己 fork 的项目: git clon ...
- 重温布局(display)
无聊,从新复习了一遍,基础布局,记录一下,避免忘了. 首先说一下 Css文件前缀 Firefox:-moz-box-shadow Safari:-webkit-box-shadow Opera:-o- ...
- HDU 1548 A strange lift (最短路/Dijkstra)
题目链接: 传送门 A strange lift Time Limit: 1000MS Memory Limit: 32768 K Description There is a strange ...
- Linux Shell 从入门到删除根目录跑路指南
1.变量为空导致误删文件base_path=/usr/sbintmp_file=`cmd_invalid`# rm -rf $base_path/$tmp_file这种情况下如果 cmd 执行出错或者 ...
- 深入理解JavaScript中创建对象模式的演变(原型)
深入理解JavaScript中创建对象模式的演变(原型) 创建对象的模式多种多样,但是各种模式又有怎样的利弊呢?有没有一种最为完美的模式呢?下面我将就以下几个方面来分析创建对象的几种模式: Objec ...