Below is my sample expect script.
#!/usr/bin/expect
set pem [lindex $argv 2]
puts -nonewline "do you want to take histogram\r"
flush stdout
gets stdin pem
if { $pem == "y" } {
send "./statsCollector.sh\r"
} else {
puts "aborting\r"
}
expect " bin\]\$ "
I need user prompt like yes,Y or y to run the my script (i.e. statsCollector.sh). If user inputs anything other like this then "aborting" should be message on window.
Here user input is not working properly, also after the aborting it hangs with that same message. Please correct me if I'm doing wrong here.