I want a script that ssh to remote server and then run a script which is at my local machine and then store the output on my local machine
Expect script for ssh to remote server:
#!/usr/bin/expect -f
set Timeout 2
set IPaddress 10.118.137.78
set Username "username"
set Password "password"
spawn ssh $Username@$IPaddress
expect "ssword:"
send "$Password\r"
script to be run on remote machine and gather the data:
#!/bin/sh
for serveraddress in `cat list.out`
do
"seeisso $serveraddress | grep -E -i ' os |proddropdown'"
done >> getos
=== Not sure how to : 1. combine both and get the result. 2 in expect script it does not takes the \r and returns to newline.