Skip to content

Instantly share code, notes, and snippets.

@davidsword
Created April 7, 2022 18:59
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 davidsword/25eb851a6d40167ba84e224410c7d317 to your computer and use it in GitHub Desktop.
Save davidsword/25eb851a6d40167ba84e224410c7d317 to your computer and use it in GitHub Desktop.
script to do s+r on mysql dump from davidsword.ca -> local dev env
#!/bin/bash
#$1 is the first parameter being passed when calling the script. The variable filename will be used to refer to this.
FILENAME=$1
DSCA_LOCALHOST_ADDR=""
echo "🏃 doing r+r"
# s+r https to http (until I get a RP setup locally)
sed -ie "s|https://davidsword.ca|http://davidsword.ca|g" $FILENAME
# s+r domain
sed -ie "s|//davidsword.ca|//$DSCA_LOCALHOST_ADDR|g" $FILENAME
# delete that extra file sed creates (doesn't seem to work without -e 🤷‍♂️)
WEIRD_FILE="${FILENAME}e"
if test -f "$WEIRD_FILE"; then
rm $WEIRD_FILE
echo "✅ deleted ${WEIRD_FILE}"
fi
echo "🔍 opening file for verification"
/usr/local/bin/code $FILENAME
echo "💪 done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment