Live data from Hacker News

The best ping story I've ever heard

askapache.com

1–10 of 49 posts

Re: The best ping story I've ever heard

#5
post #2

Do someone know how to run a command for every line emitted in a unix pipe? I tried the oneliner in the linked story using Mac OS X’s `say`, but it doesn’t work with pipes.

ping goodhost | sed -l 's/.*/ping/' | while read line; do echo $line | say; done

Re: The best ping story I've ever heard

#7
post #5
post #2

Do someone know how to run a command for every line emitted in a unix pipe? I tried the oneliner in the linked story using Mac OS X’s `say`, but it doesn’t work with pipes.

ping goodhost | sed -l 's/.*/ping/' | while read line; do echo $line | say; done

You might want to use "--unbuffered" flag in sed execution.

Re: The best ping story I've ever heard

#8
post #5
post #2

Do someone know how to run a command for every line emitted in a unix pipe? I tried the oneliner in the linked story using Mac OS X’s `say`, but it doesn’t work with pipes.

ping goodhost | sed -l 's/.*/ping/' | while read line; do echo $line | say; done

Bit of a tangent, but using the voice "Tom" on OS X, saying "ping" says "pling" instead. Fine with other voices but rather curious.

Re: The best ping story I've ever heard

#10
post #2

Do someone know how to run a command for every line emitted in a unix pipe? I tried the oneliner in the linked story using Mac OS X’s `say`, but it doesn’t work with pipes.

In a typical UNIX fashion, there's a program that runs programs:

  ping 127.0.0.1 | sed -e 's/.*/ping/' | xargs -d'\n' -n1 say
Post reply on HN