#!/bin/sh
# This script send a text sms at the command line by creating
# a sms file in the outgoing queue.
# I use it for testing.

# $1 is the destination phone number
# $2 is the message text
# if you leave $2 or both empty, the script will ask you
. /var/run/sms.conf
[ -z $SMS_FOLDER ] && SMS_FOLDER="/var/spool/sms"

DEST=$1
TEXT=$2

if [ -z "$DEST" ]; then
  echo "Destination: "
  read DEST
fi

if [ -z "$TEXT" ]; then
  echo "Text: "
  read TEXT
fi

FILE="$SMS_FOLDER/outgoing/send_$$$RANDOM"

echo "To: $DEST" > $FILE
echo "" >> $FILE
echo -n "$TEXT" >> $FILE

