I trying to use the spawn command to connect to remote server, execute some commands/script.
Here is script:
#!/usr/bin/expect
for i in `srvctl status database -d PROD | awk -F " " '{print $(NF)}'`
do
echo "value of i is $i"
spawn ssh "$i"
echo "vijay"
done
Here is output
bash-3.2$ sh a.sh
value of i is prod1
a.sh: line 8: spawn: command not found
vijay
value of i is prod2
a.sh: line 8: spawn: command not found
vijay
I am using RHEL 5.11 .
bash-3.2$ expect -v
expect version 5.43.0
Thanks in Advance.