Simple image host.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mbell 585B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. # Written by Francis Wharf, https://github.com/xeom
  3. # Default
  4. name="<unknown>"
  5. # If there is an argument, use it as program name
  6. [[ $1 ]] && name=$1
  7. while true; do
  8. # Read, ignoring escapes, until the first bell char if
  9. # no bell is received in 10 seconds, the script loops
  10. read -r -d $(printf "\007") -t 10;
  11. code=$?
  12. # If the code is a timeout error, continue
  13. if [[ $code > 128 ]]; then
  14. continue
  15. # If read returned eof, suicide
  16. elif [[ $code != 0 ]]; then
  17. exit 0
  18. fi
  19. # If read returned success, notify user of bell
  20. mnotify "$name" "Bell received"
  21. done;