Created
February 8, 2013 00:24
-
-
Save whyisjake/4735519 to your computer and use it in GitHub Desktop.
Shell script that updates the wp-config.php file to the database name. Useful when you manage a lot of different sites.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$1" = "" ]] | |
then | |
echo "Usage: $0 dbname"; | |
exit 0; | |
fi | |
FILE="/Users/jspurlock/Sites/wp-config1.php" | |
#FILE="/Users/jspurlock/Sites/wp-config.php" | |
DB_NAME="$1" | |
echo "Comment out all define DB_NAME lines" | |
sed -i.bak '/DB_NAME/ s/^define/\/\/define/' $FILE; | |
#sleep 5; | |
echo "Uncomment DB_NAME: $DB_NAME" | |
sed -i.bak "/$DB_NAME/ s/^\/\/define/define/" $FILE; | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment