Browse Source

Better code to check domain name

old-stable
Mitesh Shah 11 years ago
parent
commit
e00ee53910
  1. 3
      src/lib/ee_lib_check_domain.sh
  2. 19
      src/lib/ee_lib_process_site_name.sh

3
src/lib/ee_lib_check_domain.sh

@ -2,7 +2,7 @@
function ee_lib_check_domain() function ee_lib_check_domain()
{ {
# Check if domain name empty # Check if domain name is empty or not
while [ -z $1 ]; do while [ -z $1 ]; do
# Ask user to enter domain name # Ask user to enter domain name
read -p "Enter domain name: " EE_DOMAIN read -p "Enter domain name: " EE_DOMAIN
@ -14,4 +14,3 @@ function ee_lib_check_domain()
# Remove http:// https:// For WordPress Setup (www.example.com) # Remove http:// https:// For WordPress Setup (www.example.com)
EE_WWW_DOMAIN=$(echo $EE_DOMAIN | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'/''") EE_WWW_DOMAIN=$(echo $EE_DOMAIN | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'/''")
} }

19
src/lib/ee_lib_process_site_name.sh

@ -1,19 +0,0 @@
# Removes https://, http://, www from site name
function ee_lib_prcoess_site_name()
{
# Check EE_SITE_NAME is empty or not
if [ -z "$EE_SITE_NAME" ]
then
# Ask users to enter domain name
read -p "Enter domain name: " EE_SITE_NAME
# Remove http:// https:// & www.
EE_DOMAIN=$(echo $EE_SITE_NAME | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'www.''" | sed "s'/''")
else
# Remove http:// https:// & www.
EE_DOMAIN=$(echo $EE_SITE_NAME | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'www.''" | sed "s'/''")
fi
# Remove http:// https:// for WordPress setup (www.example.com)
EE_WWWDOMAIN=$(echo $EE_SITE_NAME | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'/''")
}
Loading…
Cancel
Save