Shell script for downloading and installing Drupal modules

#!/bin/bash

# Note (22/5-09)
# you can use a module called drush for the same
# See: http://drupal.org/project/drush
#
# when you have drush installed. You just:
#
# drush dl modulename (and then inside your module dir:)
# drush enable modulename
#

###################################################
#
# Got tired of downloading / unpacking / moving
# packages when I tested Drupal modules. So I made a
# Small shell script for downloading drupal modules
# And placing them in your modules folder
# Edit:
# module_dir=./yoursite/modules/
#
# Usage: ./drupal-module-install.sh
#    Enter module URL to fetch and module will be
#    installed
#
###################################################

###################################################
#
# Conf: Edit next line
# Place to put the downloaded modules
# Your Drupal modules folder
#
###################################################

module_dir="/home/dennis/www/www.os-cms.net/htdocs/modules/"

###################################################

echo "Enter URL with module to fetch and install"
echo "Example:"
echo "http://ftp.drupal.org/files/projects/blocks404-6.x-1.0.tar.gz"

read package
echo "Fetching package $package"
wget $package

#split url with "/" to get package name
#eg.: http://ftp.drupal.org/files/projects/blocks404-6.x-1.0.tar.gz
#will now split in 6 pieces for every piece seperated by /
#package name is in last element ${arr[5]}

IFS="/"
set -- $package
arr=( $package )
IFS=""

package_file=${arr[5]}

#extract
echo "extracting package"

tar xfz $package_file
echo "Done extracting"

#will now split package name and find directory name to be moved
#will place module in ${arr[0]}
IFS="-"
set -- $package_file
arr=( $package_file )
IFS=""

#move the module dir to modules
module=${arr[0]}

#echo "Moving $module to $module_dir"
mv ./$module $module_dir

#clean up
echo "Removing $package_file"
rm $package_file
echo "Done"
echo "Go to your site and enable your new module!"

exit 0