Dhruvak
November 17, 2011, 7:13am
1
Hi All,
I am writing a script(Auto_Installation.sh) which is calling one another script (./update_manager /spare/install/HO7/PME_Response_file.txt)
Now the issue is result of (./update_manager /spare/install/HO7/PME_Response_file.txt) script is
##########################################
OAM Update Manager - Main Menu
==============================
1. Install an OAM PME
2. Uninstall an OAM PME
3. View installed OAM PMEs
4. Exit the Update Manager
Choose an Option:
##########################################
NOw I want to give input as "1". so that script can move forward.
I tried expect command but I am failing every time
IN Auto_Installation.sh
./update_manager /spare/HO16/pme.response.template
expect "Choose an Option:"
send 1\r
o/p of this is
^Ccouldn't read file "Choose an Option:": no such file or directory
expect_example.sh: line 7: send: command not found
I am not sure how to utilize expect in this case.
Please help me.
Thanks,
Dhruvak
India
Try this...
echo 1 | ./update_manager /spare/install/HO7/PME_Response_file.txt
If you have autoexpect installed, try that...
--ahamed
Dhruvak
November 17, 2011, 8:46am
3
Hi Ahmed,
Thanks for reply. I could not follow that command because after pressing "1" I need to install certain PMEs and for that I need to give absolute path for those PMEs.
So, inshort I need to pass total 7 outputs inside ./update_manager /spare/install/HO7/PME_Response_file.txt script.
Then update manager script will be over.
That is why I am trying expect command.
Thanks,
Dhruvak
If there are so many inputs, why not have a configuration file and read the data from that...
--ahamed
Dhruvak
November 18, 2011, 4:41am
5
How? Will you please give an example?
---------- Post updated at 04:41 AM ---------- Previous update was at 12:30 AM ----------
Will anyone please help me in this case?
Dhruvak
November 23, 2011, 5:46am
7
So, Finally I found a solution.
#!/usr/bin/expect
spawn -noecho /opt/opwv/oam/1.8/bin/update_manager /spare/HO16/pme.response.template
expect "Option:"
send 3\r
expect "detailed information:"
send 1\r
expect "continue:"
send \n\r
And call this script like
./expect_example.sh