Raven commited on 2015-04-20 20:07:32
Zeige 2 geänderte Dateien mit 61 Einfügungen und 0 Löschungen.
| ... | ... |
@@ -0,0 +1,53 @@ |
| 1 |
+#!/bin/bash |
|
| 2 |
+############# |
|
| 3 |
+user=raven |
|
| 4 |
+password=b89e8bd7e3e456ad7c137f70818052f7 |
|
| 5 |
+from=1 |
|
| 6 |
+action=send |
|
| 7 |
+typ=2 |
|
| 8 |
+timestamp=0 |
|
| 9 |
+return=text |
|
| 10 |
+httphead=1 |
|
| 11 |
+############## |
|
| 12 |
+n=1; |
|
| 13 |
+for entry in $(cat ~/src/sms/contacts);do |
|
| 14 |
+echo $n $entry; |
|
| 15 |
+n=$(($n+1)) |
|
| 16 |
+done; |
|
| 17 |
+ |
|
| 18 |
+while true |
|
| 19 |
+do |
|
| 20 |
+ # (1) prompt user for recipent, and read command line argument |
|
| 21 |
+ read -p "To: " toinput |
|
| 22 |
+ # (2) handle the input we were given |
|
| 23 |
+ case $toinput in |
|
| 24 |
+ [\+0][0-9]* ) nr=$toinput; break;; |
|
| 25 |
+ [1-9]* ) n=0; |
|
| 26 |
+ for entry in $(cat ~/src/sms/contacts);do |
|
| 27 |
+ n=$(($n+1)) |
|
| 28 |
+ if (($n==$toinput)); then |
|
| 29 |
+ nr=$(echo $entry|cut -d ',' -f2) |
|
| 30 |
+ fi |
|
| 31 |
+ done |
|
| 32 |
+ break;; |
|
| 33 |
+ * ) echo 'Please enter the nr. of an entry or a full phonenumber';; |
|
| 34 |
+ esac |
|
| 35 |
+done |
|
| 36 |
+ |
|
| 37 |
+ # (3) prompt user for message content, and read command line argument |
|
| 38 |
+read -p "Message:" messageinput |
|
| 39 |
+while true |
|
| 40 |
+do |
|
| 41 |
+ # (1) prompt user, and read command line argument |
|
| 42 |
+ read -p "Send message to $nr?[n] " answer |
|
| 43 |
+ # (2) handle the input we were given |
|
| 44 |
+ case $answer in |
|
| 45 |
+ [nN]* ) action=info;break;; |
|
| 46 |
+ * ) break;; |
|
| 47 |
+ esac |
|
| 48 |
+done |
|
| 49 |
+echo ----------- |
|
| 50 |
+ curl http://www.sms-revolution.ch/API/httpsms.php -d user=$user \ |
|
| 51 |
+ -d password=$password --data-urlencode "text=$messageinput" \ |
|
| 52 |
+ -d to=$nr -d from=$from -d action=$action -d typ=$typ \ |
|
| 53 |
+ -d timestamp=$timestamp -d return=$return -d httphead=$httphead |
|
| 0 | 54 |