I want to create a script which i will use to generate some reports, but to do that i have to answer few questions, which being asked by other script i run (already located in destination server in /tmp)
The answers can be yes, no, for some questions i need to select 1,2 or 3, i some cases i need "Press [Enter] to continue:"... So my questions how to do it in the best way?
How do i ssh to destination servers (are located in file on source jump server and to which i have passworless connection to from jump server) like i do it in bash?
#!/bin/bash
while read LINE ; do
ssh - $LINE <<"EOF"....
This is my script as of now, the order of the answers is: yes/yes/yes/ENTER/2/3/1/no/no/yes
#!/usr/bin/expect -f
spawn ssh ???????
send -- "/tmp/sort_hpux.sh\r"
expect "Would you like to run the data collector now? [y,n] (y)"
send -- "y\r"
expect "Directory '/var/VRTS/VRTSspt' does not exist. Do you want to create it? [y,n,q] (y)"
send -- "y\r"
expect "Press [Return] to indicate your acceptance of the terms and conditions as indicated in the /tmp/./sort/advanced/terms.txt file, or q to decline: (y)"
send -- "y\r"
expect "Press [Return] to continue:"
send -- "\r"
expect "Choose your option: [1-2,q] (1)"
send -- "2\r"
expect "Choose your option (separate multiple selections with commas): [1-5,b,q] (1,2,3)"
send -- "3\r"
expect "Choose your option: [1-3,b,q] (1)"
send -- "1\r"
expect "Do you want to create a sanitized report with no hostnames and IP addresses? [y,n,q] (n)"
send -- "n\r"
expect "Would you like to send SORT Data collector session logs to Veritas to help improve SORT Data collector in future? [y,n,q] (y)"
send -- "n\r"
expect "Your tasks are completed. Would you like to exit the data collector? [y,n,q] (y)"
send -- "y\r"
expect eof