Raven commited on 2015-04-21 11:19:41
Zeige 1 geänderte Dateien mit 17 Einfügungen und 1 Löschungen.
| ... | ... |
@@ -8,6 +8,8 @@ typ=2 |
| 8 | 8 |
timestamp=0 |
| 9 | 9 |
return=text |
| 10 | 10 |
httphead=1 |
| 11 |
+ |
|
| 12 |
+sms_tempfile=~/.sms_temp |
|
| 11 | 13 |
############## |
| 12 | 14 |
n=1; |
| 13 | 15 |
for entry in $(cat ~/src/sms/contacts);do |
| ... | ... |
@@ -34,6 +36,8 @@ do |
| 34 | 36 |
esac |
| 35 | 37 |
done |
| 36 | 38 |
|
| 39 |
+tempdata=0 |
|
| 40 |
+ |
|
| 37 | 41 |
# (3) prompt user for message content, and read command line argument |
| 38 | 42 |
read -p "Message: " messageinput |
| 39 | 43 |
|
| ... | ... |
@@ -44,6 +48,11 @@ case $messageinput in |
| 44 | 48 |
cat ) |
| 45 | 49 |
echo -n 'Message: ' |
| 46 | 50 |
messageinput=$(cat);; |
| 51 |
+ vim ) |
|
| 52 |
+ touch $sms_tempfile |
|
| 53 |
+ tempdata=1 |
|
| 54 |
+ vim $sms_tempfile |
|
| 55 |
+ messageinput=$(cat $sms_tempfile);; |
|
| 47 | 56 |
* ) ;; |
| 48 | 57 |
esac |
| 49 | 58 |
|
| ... | ... |
@@ -61,4 +70,11 @@ echo ----------- |
| 61 | 70 |
curl http://www.sms-revolution.ch/API/httpsms.php -d user=$user \ |
| 62 | 71 |
-d password=$password --data-urlencode "text=$messageinput" \ |
| 63 | 72 |
-d to=$nr -d from=$from -d action=$action -d typ=$typ \ |
| 64 |
- -d timestamp=$timestamp -d return=$return -d httphead=$httphead |
|
| 73 |
+ -d timestamp=$timestamp -d return=$return -d httphead=$httphead \ |
|
| 74 |
+if (($tempdata==1)); then |
|
| 75 |
+ if $(echo $response | grep 200); then |
|
| 76 |
+ rm $sms_tempfile |
|
| 77 |
+ else |
|
| 78 |
+ echo "response was not 200, leaving tempfile where it is" |
|
| 79 |
+ fi |
|
| 80 |
+fi |
|
| 65 | 81 |