#source
if [ -z $1 ] || ![ -d $1 ]
then
  s=~/grade-rating/
else
  s=$1
fi

#destination
if [ -z $2 ] || ![ -d $2 ]
then
  d=~/public_html/
else  
  d=$2
fi

#shopt -s dotglob
cp -rp ${s}~dev_rating/* $d
cp ${s}~dev_rating/.htaccess ${d}/.htaccess
rm -rf ${d}/application/config

echo -n "Enter password for mysql user 'mmcs_rating': "
read -s mysqlpswd
echo ""
yes | mysqladmin -u mmcs_rating -p$mysqlpswd drop mmcs_rating
mysqladmin -u mmcs_rating -p$mysqlpswd create mmcs_rating
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/Structure.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/StoredProcedures.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/Sample.sql

