Created
January 28, 2021 14:01
-
-
Save ozzi-/8b3f037844864bd809cc7da33aff1b6a to your computer and use it in GitHub Desktop.
follow meta equiv redirect with bash and curl
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
equiv=$(curl $YOURURL -sS | grep -i "http-equiv") | |
shopt -s nocasematch | |
regexp='\<meta http-equiv=\"*refresh\"* content=\"*[0-9]*\"*;\s*url=([a-zA-Z0-9\/\.\?=#&.]*)' | |
path="" | |
if [[ $equiv =~ $regexp ]]; then | |
echo "${BASH_REMATCH[1]}" | |
# curl $YOURURL${BASH_REMATCH[1]} | |
else | |
echo "Could not parse equiv!" | |
exit 3 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment