Created
April 7, 2022 18:59
-
-
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
This file contains 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 | |
#$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