在脚本中 echo/print 出来就行了
例子:
> ssh root@192.168.1.213 "ping
v2ex.com" >> test 2>&1
> cat test
> PING
v2ex.com (14.152.44.135) 56(84) bytes of data.
64 bytes from 14.152.44.135: icmp_seq=1 ttl=52 time=21.3 ms
64 bytes from 14.152.44.135: icmp_seq=2 ttl=52 time=21.3 ms
64 bytes from 14.152.44.135: icmp_seq=3 ttl=52 time=21.2 ms
64 bytes from 14.152.44.135: icmp_seq=4 ttl=52 time=21.4 ms
64 bytes from 14.152.44.135: icmp_seq=5 ttl=52 time=21.2 ms
64 bytes from 14.152.44.135: icmp_seq=6 ttl=52 time=27.7 ms
64 bytes from 14.152.44.135: icmp_seq=7 ttl=52 time=20.3 ms
64 bytes from 14.152.44.135: icmp_seq=8 ttl=52 time=20.5 ms
64 bytes from 14.152.44.135: icmp_seq=9 ttl=52 time=20.4 ms
64 bytes from 14.152.44.135: icmp_seq=10 ttl=52 time=20.2 ms
---
v2ex.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9030ms
rtt min/avg/max/mdev = 20.279/21.586/27.712/2.086 ms