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
Expect:is based onTcla relatively simple language for a free scripting toolused to implement automated and interactive task programs for communication without manual intervention. For example:ssh ftp , and so on, these programs normally need to
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:
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,
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
Expect is a tool for dealing with interactions, usually for scenarios where you need to enter data manually, and you can use expect in your scripts to automate. installation
First check to see if there are any installed expect in the system.
In shell development, when we connect to FTP or passwd or sudo, we need to enter the password manually. This is obviously inappropriate for automation. And expect's strong interaction model solves this problem. I am involved in this work, the
SCP is very powerful, but requires manual input of password, of course, you can save the public key in the remote host's ~/.ssh directory, and then do not enter password, but this needs to be configured.Use Sshpass may enter password in command, but
Using expect to implement automatic interaction of shell scripts
It is very effective for complex interactions and even different processing with different screen output.
And the General Linux, Unix have. It's very easy to use and powerful.
One of the most recent tasks in preparing a deployment is to send some files, such as installation packages, to a large number of
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:
and provide relevant evidence. A staff member will contact you within 5 working days.