Hello everyone,
I am still working on my WordPress installation script. I am trying to ask the users to type the administrator email address two times and do a check on it. At the moment I am stuck at line 22. How do I get the script to ask to type the email again and perform the check to see if the email is formatted correctly?
I think that my script can also be simplified/compressed. Please feel free to comment if you have any advice for me (I am in process of learning shell scripting). The block of code is below.
My other question is about database connection. In a normal scenario, I would do the following to create the database via a script (username and password saved in the ~/.my.cnf file):
My problem is that the database is in a different jail on the same host. Any idea how do can I create a remote connection to create the new WordPress database?
Thank you all.
Fred
I am still working on my WordPress installation script. I am trying to ask the users to type the administrator email address two times and do a check on it. At the moment I am stuck at line 22. How do I get the script to ask to type the email again and perform the check to see if the email is formatted correctly?
I think that my script can also be simplified/compressed. Please feel free to comment if you have any advice for me (I am in process of learning shell scripting). The block of code is below.
Code:
1 #!/bin/sh
2 #
3
4 read -p "Enter email : " e
5 echo "$e" | grep '^[a-zA-Z0-9]*@[a-zA-Z0-9]*\.[a-zA-Z0-9]*$'
6 while [ $? -eq 1 ]; do
7 echo "Error: Enter a valid email address"
8 read -p "Enter email : " e
9 echo "$e" | grep '^[a-zA-Z0-9]*@[a-zA-Z0-9]*\.[a-zA-Z0-9]*$'
10 done
11
12 read -p "Confirm email : " e2
13 echo "$e2" | grep '^[a-zA-Z0-9]*@[a-zA-Z0-9]*\.[a-zA-Z0-9]*$'
14 while [ $? -eq 1 ]; do
15 echo "Error: Enter a valid email address"
16 read -p "Enter email : " e2
17 echo "$e" | grep '^[a-zA-Z0-9]*@[a-zA-Z0-9]*\.[a-zA-Z0-9]*$'
18 done
19
20 if [ $e!=$e2 ]; then
21 echo "Email adress doesn't match!"
22 ????
23 fi
My other question is about database connection. In a normal scenario, I would do the following to create the database via a script (username and password saved in the ~/.my.cnf file):
Code:
# Create the database
/usr/bin/mysql -e "CREATE DATABASE $db_name"
/usr/bin/mysql -e "GRANT ALL PRIVILEGES ON $db_name.* to '"$db_user"'@'localhost' IDENTIFIED BY '"$db_password"';"
My problem is that the database is in a different jail on the same host. Any idea how do can I create a remote connection to create the new WordPress database?
Thank you all.
Fred