Skip to content

Instantly share code, notes, and snippets.

@alberto56
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alberto56/e90e8a30dc73c4df8395 to your computer and use it in GitHub Desktop.
Save alberto56/e90e8a30dc73c4df8395 to your computer and use it in GitHub Desktop.
Use existing Drupal database
#!/bin/bash
if [ "$#" -ne "3" ]
then
echo "Please supply exactly three arguments:"
echo ""
echo " (1) the database username"
echo " (2) the database password, or NOPWD if none"
echo " (3) the database name"
else
if [ "$2" == "NOPWD" ]; then
PASS=""
else
PASS="$2"
fi
echo '$'"databases = array ( 'default' => array ( 'default' => array ( 'database' => '$3', 'username' => '$1', 'password' => '$PASS', 'host' => 'localhost', 'port' => '', 'driver' => 'mysql', 'prefix' => '')),);" >> sites/default/settings.php
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment