I'm a bash scripting newb that is trying to write a script to retrieve ospf neighbors from routers that don't support that through snmp. The following script works:
#!/bin/bash
rm ./results.txt
sshpass -f pfile ssh -T [email protected] > results.txt <<"ENDSSH"
show ip route ospf neighbor
exit
ENDSSH
Rather than put the results in a text file I would like them to be in a variable so I can parse the results. I've tried the following to no avail:
MYVAR=$(sshpass -f pfile ssh -T [email protected] <<"ENDSSH"
show ip route ospf neighbor
exit
ENDSSH)
Any help is appreciated.
MYVAR=$(sshpass -f pfile ssh -T [email protected] <<"ENDSSH"; show ip route ospf neighbor; exit; ENDSSH;)