bfe62ea7e0b4b30902ba4e118a6666a9f51d1c64
Raven First version of the script...

Raven authored 8 years ago

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
Raven added sed and cat input opt...

Raven authored 8 years ago

38) read -p "Message: " messageinput
39) 
40) case $messageinput in
41)     sed )
42)         echo -n 'Message: '
43)         messageinput=$(sed '/^$/q');;
44)     cat )
45)         echo -n 'Message: '
46)         messageinput=$(cat);;
47)     * ) ;;
48)     esac
49)