Advertisement
Guest User

steven

a guest
Dec 24th, 2010
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #TODO - make the showmsgs script the centerpiece
  4. #TODO - is daemon running? Kill daemon trigger here as well.
  5. #TODO - PHONEBOOK
  6. #TODO - force read
  7. #TODO - lockfile for daemon process & force read
  8.  
  9. #if [ $1 = "send" ]
  10. #then
  11. #if [ $# -ne 3 ]
  12. # then
  13. #echo -e "\E[0;36mPlease input your message."; tput sgr0
  14. # read message
  15. # echo -e "\E[0;34mPlease input the number."; tput sgr0
  16. #read number
  17. # fi
  18.  
  19. #echo "$message" | gammu --sendsms TEXT $number
  20. #fi
  21.  
  22. #echo $1
  23. #echo $2
  24. #echo $3
  25. #echo $#
  26.  
  27. #this checks for new messages - it's the default if no command line options.
  28.  
  29. for i in /home/steven/opt/spool/gammu/inbox/*_unread.txt; do
  30. echo -e "\E[0;34m########################################################"; tput sgr0
  31. #getting a fault if i is nothing. Whoops.
  32. if [ -f $i ]
  33. then
  34. cat $i
  35. echo -e "\E[0;32m(\E[0;37mr\E[0;32m)eply, (\E[0;37mm\E[0;32m)ark read, (\E[0;37mk\E[0;32m)eep unread? "; tput sgr0
  36. read CHOICE
  37. case "$CHOICE" in
  38. "r")
  39. echo -e "\E[0;36mPlease input your message."; tput sgr0
  40. read message
  41. #echo $i
  42. number=`head -1 $i`
  43. echo "$message" | gammu --sendsms TEXT $number
  44. mv "$i" "${i/_unread.txt}"_read.txt
  45. ;;
  46. "m")
  47. echo "marking as read"
  48. mv "$i" "${i/_unread.txt}"_read.txt
  49. ;;
  50. "*")
  51. echo "keeping unread, no notify"
  52. ;;
  53.  
  54. esac
  55. fi
  56. done;
  57. if [ -f /home/steven/opt/spool/gammu/.notify ]
  58. then
  59. rm /home/steven/opt/spool/gammu/.notify
  60. fi
  61. #
  62.  
  63. #while true; do
  64.  
  65. #gammu --geteachsms > /tmp/gammu_sms.tmp
  66. #./smsparser
  67.  
  68. #if [ -f /home/steven/opt/spool/gammu/.notify ]
  69. # then
  70. # notify-send --icon=blueman "Text Message Recieved"
  71. #fi
  72.  
  73. ## to be marking them as read...
  74. ## for i in *.txt; do mv "$i" "${i/_unread.txt}"_read.txt; done
  75. #code
  76. #sleep 120
  77. #done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement