scripts

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

commit 4ea927f0f061dae2ca86a57b8beeb5ea79b2acc8
parent 28760241f8746be4327949f5b2b446bf7c054f1e
Author: lostd <lostd@2f30.org>
Date:   Wed Aug  7 04:02:09 +0300

wrapper for mycosmos that handles a phonebook csv

Diffstat:
sendtext | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/sendtext b/sendtext @@ -0,0 +1,22 @@ +#!/bin/sh + +CONF=$HOME/.sendtextrc +LOGIN=$(grep login $CONF | sed 's/login=//') +PASS=$(grep pass $CONF | sed 's/pass=//') +PHONEBOOK=$HOME/.phonebook.csv + +NAME=$1 +MSG=$2 + +EXACT=$(awk -F';' '{ print $1; }' $PHONEBOOK | grep "^$NAME$") +NUMBER=$(grep "^$NAME;" $PHONEBOOK | awk -F';' '{ print $2; }') + +if [ "$EXACT" != "" ]; then + echo -n "send to $EXACT? " + read ENTER + mycosmos $LOGIN $PASS $NUMBER "$MSG" +else + MANY=$(awk -F';' '{ print $1; }' $PHONEBOOK | grep "$NAME" | wc -l) + WHICH=$(awk -F';' '{ print $1; }' $PHONEBOOK | grep "$NAME") + echo $MANY matches for $NAME: $WHICH +fi