In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Brief introduction
Expect is a tool based on the TCL language, which is designed to solve the problem of non-interchangeability in shell scripts. Only the output of processes started by the spawn command can be captured.
Basic command
Send: sends a string to the process to simulate the user's input
Expect: determines whether the result of the last output contains the specified string. If it is returned immediately, it will be returned after waiting for the timeout.
Spawn: start the process and track subsequent interactions
Interact: maintain the interactive state after the execution is completed, and hand over the control to the console
EOF: end interaction statu
Timeout: specifies the timeout. The default is 10s timeout-1, which never times out.
Exp_continue allows expect to continue to execute commands downwards
Send_user echo command, which is equivalent to echo
Array of $argv parameters: the expect script can accept parameters passed from bash, which can be obtained using [lindex $argv n], where n starts at 0 and represents the first parameter.
Expect execution mode
Direct execution
Embedded execution
Directly execute the script declaration: #! / usr/bin/expect
Embedded execution script declaration: #! / bin/bash
Script instance
1 log in to other hosts remotely
Direct execution
Embedded execution
2 create a user and set a password
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.