can someone help please? I'm trying to catch/pipe ping response from remote cisco router over ssh (see script). Everything works well but only at ping the pipe brokes at first "!" ping response from router destination:
routername#ping xxx.xxx.xxx.xxx source loopback xx Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to xxx.xxx.xxx.xxx, timeout is 2 seconds: Packet sent with a source address of xxx.xxx.xxx.xxx !
And that's all... It seems to break after the first "!".
Where this works well and catch and give back whole ping result:
ssh "user@$1" 'ping xxx.xxx.xxx.xxx source loopback xx' > log ssh user@$1 "ping xxx.xxx.xxx.xxx source loopback xx" | tee -a log
but only as single line command. What can I do to catch the whole output until end?
#!/bin/bash echo "$1" var1=$(ssh user@$1 << "ENDSSH" sh version | incl System image file sh ip interface INTx | incl MTU show controllers VDx | incl Speed sh cellular 0 radio | include RSS sh cellular 0 netw | include Selected ping xxx.xxx.xxx.xxx source loopback xx ENDSSH) echo "$var1" > log