#!/bin/bash
# part of tktiny-0.1.tcl script
# tested with grep 2.5, wget 1.10.1, awk 3.1.5

# this script must be executable (chmod +x make_tiny)

# Author: Tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html


DIR="tiny_fetcher"

TIMEOUT="20"

URLTMP="tiny.tmp"
TINYLINKDB="tiny_link.db"

wget -t 1 --connect-timeout=$TIMEOUT -U "Mozilla/5.0 (X11; Linux i686; U; en) Opera 8.5" -q "http://tinyurl.com/create.php?url=$1" -O $DIR/$URLTMP

grep "name\=tinyurl" $DIR/tiny.tmp | awk -F"\"" '{print $2}' > $DIR/$TINYLINKDB
