scripts

misc scripts and tools
git clone git://git.2f30.org/scripts
Log | Files | Refs

sendtext (598B)


      1 #!/bin/sh
      2 
      3 CONF=$HOME/.sendtextrc
      4 LOGIN=$(grep login $CONF | sed 's/login=//')
      5 PASS=$(grep pass $CONF | sed 's/pass=//')
      6 PHONEBOOK=$HOME/.phonebook.csv
      7 
      8 NAME=$1
      9 MSG=$2
     10 
     11 EXACT=$(awk -F';' '{ print $1; }' $PHONEBOOK | grep "^$NAME$")
     12 NUMBER=$(grep "^$NAME;" $PHONEBOOK | awk -F';' '{ print $2; }')
     13 
     14 if [ "$EXACT" != "" ]; then
     15     echo -n "send to $EXACT? "
     16     read ENTER
     17     mycosmos $LOGIN $PASS $NUMBER "$MSG"
     18 else
     19     MANY=$(awk -F';' '{ print $1; }' $PHONEBOOK | grep "$NAME" | wc -l)
     20     WHICH=$(awk -F';' '{ print $1; }' $PHONEBOOK | grep "$NAME")
     21     echo $MANY matches for $NAME: $WHICH
     22 fi