Skip to content

Instantly share code, notes, and snippets.

@lelandbatey
Created January 14, 2015 20:49
Show Gist options
  • Save lelandbatey/af4ee3e8d1cb1c03b501 to your computer and use it in GitHub Desktop.
Save lelandbatey/af4ee3e8d1cb1c03b501 to your computer and use it in GitHub Desktop.
Have your computer speak when a ping works, like in this classic story: http://ftp.arl.mil/mike/ping.html
#!/bin/bash
# Ping-speaker oneliner
# This shell oneliner will ping a host once twice every second, then call my
# custom text-to-speech program to speak that output. This is meant to act
# similarly to the classic story of a use for ping found here:
# http://ftp.arl.mil/mike/ping.html
# Be aware, I wrote this to work on Cygwin on my system specifically. It also
# relies on a custom program, "text-to-speech.exe" that I haven't released the
# source code for. So this is not really all that useful for anyone else :/
{ while true; do ping "$1" -n 1 > /dev/null 2>&1 && echo "ping" && sleep 0.5; done } | { while read line; do text_to_speech.exe $line & done }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment