#!/bin/sh

NRFILE="sms.numbers"

to=$2

if [ -f ${NRFILE} ]; then
    nr=`grep ^$2 ${NRFILE}` 

    if [ ! -z "${nr}" ]; then
        to=`echo ${nr} | cut -d' ' -f 2-`
    else
        echo "No entry file, using destination as number"
    fi
else
    echo "No nick database, using destination as number"
fi

echo $* | cut -d' ' -f 3- | smssend ${to} $1 0
echo "sms sent"
