Skip to content

Instantly share code, notes, and snippets.

@ozzi-
Created January 28, 2021 14:01
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 ozzi-/8b3f037844864bd809cc7da33aff1b6a to your computer and use it in GitHub Desktop.
Save ozzi-/8b3f037844864bd809cc7da33aff1b6a to your computer and use it in GitHub Desktop.
follow meta equiv redirect with bash and curl
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