#!/bin/bash
#############################################
# script to check whether database exists or not
#
#
#
# Made By : Damanpreet Singh (DEMON)
# http://damanpreet.co.cc/
#
#
# created : 13-11-2012 # VER=1.1
#
#############################################
echo "enter mysql username"
read u
echo "enter mysql password"
read p
echo "enter database name to check"
read db_name
RESULT=`mysql --user="$u" --password="$p" --skip-column-names -e "SHOW DATABASES LIKE '$db_name'"`
if [ $RESULT ]; then
echo "Database exist"
else
echo "Database does not exist"
fi
#############################################
# script to check whether database exists or not
#
#
#
# Made By : Damanpreet Singh (DEMON)
# http://damanpreet.co.cc/
#
#
# created : 13-11-2012 # VER=1.1
#
#############################################
echo "enter mysql username"
read u
echo "enter mysql password"
read p
echo "enter database name to check"
read db_name
RESULT=`mysql --user="$u" --password="$p" --skip-column-names -e "SHOW DATABASES LIKE '$db_name'"`
if [ $RESULT ]; then
echo "Database exist"
else
echo "Database does not exist"
fi
No comments:
Post a Comment