#!/bin/bash
#wget http://smileys.smileycentral.com/cat/36/36_1_22.gif

if [[ $# != 1 ]]
then
    echo "Usage: $0 <number of smileys>"
    echo
    echo "The number of smileys possible seem to be 67 currently"
    echo
    echo "Purpose: get the animated smileys from smileycentral.com"
    echo "The save directory will be '2005-04-29-smileys"
    exit 0
fi

LIMIT=$1
dir=`date '+%F'`
if [ ! -e "$dir-smileys" ]
then
    mkdir $dir-smileys
    cd $dir-smileys
else
    echo "Folder $dir-smileys already exists."
    echo "Please remove $dir-smileys and try again."
    exit 0
fi

for ((a=1; a <= LIMIT ; a++))  # Double parentheses, and "LIMIT" with no "$".
do
    wget http://smileys.smileycentral.com/cat/36/36_1_$a.gif > /dev/null 2>&1
done
echo "Done getting $LIMIT smileys"

exit 1