| version 1.5, 2002/06/17 11:08:01 |
version 1.6, 2002/06/17 17:39:18 |
|
|
| # |
# |
| # You'll need wget-special which saves also transitional cookies |
# You'll need wget-special which saves also transitional cookies |
| # if you're on pauli server try /home/k/9karas/bin/wget-special |
# if you're on pauli server try /home/k/9karas/bin/wget-special |
| |
# |
| |
|
| |
CONFIG_FILE="$HOME/.sms.sh.conf"; |
| |
|
| if [ $# -lt 1 ]; then |
if [ $# -lt 1 ]; then |
| echo -e "Usage:\n $0 GSM_number\n"; |
echo -e "Usage:\n $0 GSM_number\n"; |
| echo "Message is taken from standart input. Only one line is allowed."; |
echo "Message is taken from standart input. Only one line is allowed."; |
| echo "Use special characters with care. Spaces are properly handled." |
echo "Use special characters with care. Spaces are properly handled."; |
| exit 1; |
exit 1; |
| fi |
fi |
| |
|
| NAME=`grep '^login=' ~/.sms.sh.conf | sed 's/^login=\(.*\)$/\1/'` |
if [ -f "$CONFIG_FILE" ]; then |
| PASS=`grep '^password=' ~/.sms.sh.conf | sed 's/^password=\(.*\)$/\1/'` |
NAME=`grep -E '^username[ ]*=[ ]*' $CONFIG_FILE \ |
| |
| sed 's/^username[ ]*=[ ]*\(.*\)$/\1/' \ |
| |
| head -n 1`; |
| |
PASS=`grep -E '^password[ ]*=[ ]*' $CONFIG_FILE \ |
| |
| sed 's/^password[ ]*=[ ]*\(.*\)$/\1/' \ |
| |
| head -n 1`; |
| |
fi |
| |
|
| if [ -z $NAME ]; then |
if [ -z "$NAME" ]; then |
| echo 'Enter username:' |
echo -n 'Enter username: ' |
| IF= read NAME |
IF= read NAME |
| |
else |
| |
echo "Using username '$NAME' from configuration file '$CONFIG_FILE'."; |
| |
fi |
| |
|
| |
if [ -z "$NAME" ]; then |
| |
echo "Empty username is not allowed."; |
| |
exit 1; |
| fi |
fi |
| |
|
| if [ -z $PASS ]; then |
if [ -z "$PASS" ]; then |
| echo 'Enter password:' |
echo -n 'Enter password: ' |
| IF= read PASS |
IF= read PASS |
| fi |
fi |
| |
|
| echo ' Enter your message (only one line, max 420 chars, it is binary safe):' |
echo 'Enter your message (only one line, max 420 chars, it is binary safe):' |
| IF= read text |
IF= read text |
| |
text=`echo "$text" | sed 's/%/%25/g; s/\+/%2B/g; s/ /+/g; s/&/%26/g'`; |
| |
|
| # download the file via special wget which stores session cookie to a file |
# download the file via special wget which stores session cookie to a file |
| wget-special \ |
wget-special \ |