1, before using expect, need to install two RPM package,
The code is as follows
Copy Code
# RPM-IHV expect-5.43.0-8.el5.i386.rpm# RPM-IHV expect-devel-5.43.0-8.el5.i386.rpm
2, the batch modifies the password
Use expect to implement automatic logon script, there are many online, but there is no clear explanation, beginners are generally copied, collection. But why do you want to write this but do not know it. This article uses a shortest example to
I've learned some shells before, but not very deep, and the time to write code is not much. Shortly before the shell was more thin, leader assigned a task to write a script with the shell to upload the Redis source tarball from one server to another
Expect everywhere.
The first time I saw expect this command was the first time I was in full volume that's one of the company's cows. A set of automatic deployment, MD5, release of the full online tool written by the shell script, when it's okay,
Small Q: patriotism means that you are a national of this country, and for this country, it should be compared to otherAll countries have deeper feelings. --George Bernard Shaw=======================================================================A:
Installing expect[[email protected] ~]# yum install -y expectUse a script to log into a remote machineScripting 1.expectThe contents are as follows:[[email protected] expect]# vim 1.expect#!/usr/bin/expectset host "192.168.130.128" #定义变量set
Recent project requirements, need to write some shell script interaction, the pipeline is not enough time, expect can be very good to implement the interaction between the script, search for information, found that many articles on the Web are
background: In the remote file download, you need to enter the other party's server password, the shell does not support interactive input content, can be implemented in the following two ways I. Embedding expect in shell scripts for password
A detailed description of Linux expect usageI. OverviewThrough the shell we can achieve simple control flow functions, such as: cycle, judgment and so on. But for situations where interaction needs to be done manually, we may sometimes need to
Expect is a tool built on TCL to automate tasks that require interaction.Because expect is TCL-based, you need to have TCL installed in your systemHow to check?[Email protected] ~]# Whereis tclTcl:/usr/lib/tcl8.4/usr/share/tcl8.4If you do not see
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.