Last active
September 24, 2020 07:29
-
-
Save Lane/8d66ecdc68c37eacedd35de4fbd21963 to your computer and use it in GitHub Desktop.
script to remove any surge subdomains you have deployed based on a provided pattern
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 | |
# Removes all surge domains that match a provided pattern | |
# | |
# Example usage: | |
# ./surge-teardown.sh test-site | |
# | |
# Output: | |
# Success - test-site-alpha.surge.sh has been removed. | |
# Success - beta-test-site.surge.sh has been removed. | |
# | |
# will remove any surge subdomains that have the string | |
# "test-site" in them. can be a regex. | |
# (e.g. ^test-site to match domains that start) | |
if [ "$1" != "" ]; then | |
surge list | grep -o "$1.*\.surge\.sh" | while read line | |
do | |
surge teardown "$line" | |
done | |
else | |
echo "must provide a pattern to match surge subdomains" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment