Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 159

Bash or Expect Script Manual Automatic Switch

$
0
0

I have updated some more explanations. For example, "any_switch_session_command" is like "/usr/bin/mysql". During "/usr/bin/mysql" session, usually only sql commands and limited bash commands can be used. If possible, would like to temporarily switch to human interaction only for the login&password input. The rest is run automatically by either the bash or expect script.

linux_prompt:# ./RandomScriptName.sh #manually executedlinux_prompt:# command_-1 #automatically runlinux_prompt:# command_0 #automatically runlinux_prompt:# /usr/bin/mysql #automatically runLogin: <inputted_a_valid_id> # temporarily handover to human to inputPassword: <inputted_a_valid_password> # temporarily handover to human to inputYou have logged in successfully.# loop back 3 times to "Login:" when password wrong.# 4th times wrong, terminate script.# "Login:" n "Password:" pop up after /usr/bin/mysql is executed. This is not implemented in the "RandomScriptName.sh" script, but already exist in the system.# Human interaction ended as per above message.(logged in successfully)# Starting below, want to handover execution to script.linux_prompt2> command_1st #automatically runlinux_prompt2> command_2nd #automatically run.../automatically run command_n-th/...linux_prompt2> exit #automatically run exitlinux_prompt:# command_n+1 #even after back to 1st session, automatically run this toolinux_prompt:# <no more commands> # end this automation script as well as commands.linux_prompt:#

Your response are highly appreciated.


Viewing all articles
Browse latest Browse all 159

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>