I want to to check a Nortel Router by running ./script:
#!/bin/ksh
print "IP:"
read ip;
ping ${ip};
ssh -l default ${ip} "sho mod; en; sho int; sho node-e; sho node-a";
I can ssh normaly with
ssh -l [user] [ip].
But not with
ssh -l [user] [ip] ‘[cmd1], [cmd2]’ it says automatically “Conection to [ip] closed.”
There’s application called
expectwhich can do that kind of interaction / terminal simulation for you. Otherwise, you could write a script usingfabricor even straight in python using paramikoRunning commands this way would be better of course, but if your router doesn’t accept commands this way, you’ll need to simulate the standard connection.