Hi,
I basically have 2 shell scripts.
One is a shell script will get the variable value from the user. The variable is nothing but the IP of the remote system.
Another shell script is a script that does the job of connecting to the remote system using ssh. This uses a expect utility in turn.
Now, i want to run the first script and and get the variable value and pass that as parameter to anpother shell script, where that value is retrieved and used to connect.
Here r excerpts from 2 scripts:
-------------------------------------------------------------------------------------
script 1:
#!/bin/bash
read -p "enter ip of the remote system": ip
echo "Now calling expect script"
./script2.sh <i want to pass the variable ip to the other script hat i am calling>
script 2:
#!/usr/bin/expect -f
spawn ssh -t <obtain the IP from the calling script i.e script 1.> "run_some_commands"
expect "passsword:"
send "password\r"
interact
----------------------------------------------------------------------------------
Now, please can some one help me with the prblem tat i am facing.
is there any way to achieve the above.
How can i call script 2 from script 1 along with passing parameters (IPaddr), which will be referenced in the second script.
Appreciate your help!!