Oct-27-2022, 08:35 PM
(Oct-27-2022, 07:04 PM)Skaperen Wrote: what if the command is a network ping and you want each ping result as soon as the command outputs it?
Output:λ ping python-forum.io | tee foo.txt
PING python-forum.io(2606:4700:3037::ac43:a8e3 (2606:4700:3037::ac43:a8e3)) 56 data bytes
64 bytes from 2606:4700:3037::ac43:a8e3 (2606:4700:3037::ac43:a8e3): icmp_seq=1 ttl=59 time=11.8 ms
64 bytes from 2606:4700:3037::ac43:a8e3 (2606:4700:3037::ac43:a8e3): icmp_seq=2 ttl=59 time=11.4 ms
64 bytes from 2606:4700:3037::ac43:a8e3 (2606:4700:3037::ac43:a8e3): icmp_seq=3 ttl=59 time=11.3 ms
64 bytes from 2606:4700:3037::ac43:a8e3 (2606:4700:3037::ac43:a8e3): icmp_seq=4 ttl=59 time=11.5 ms
^C
λ cat foo.txt
PING python-forum.io(2606:4700:3037::ac43:a8e3 (2606:4700:3037::ac43:a8e3)) 56 data bytes
64 bytes from 2606:4700:3037::ac43:a8e3 (2606:4700:3037::ac43:a8e3): icmp_seq=1 ttl=59 time=11.8 ms
64 bytes from 2606:4700:3037::ac43:a8e3 (2606:4700:3037::ac43:a8e3): icmp_seq=2 ttl=59 time=11.4 ms
64 bytes from 2606:4700:3037::ac43:a8e3 (2606:4700:3037::ac43:a8e3): icmp_seq=3 ttl=59 time=11.3 ms
64 bytes from 2606:4700:3037::ac43:a8e3 (2606:4700:3037::ac43:a8e3): icmp_seq=4 ttl=59 time=11.5 ms