Last active
September 17, 2022 18:44
-
-
Save moonexpr/c6f00e40d5a4a8c2a5cb7d4be32783bb to your computer and use it in GitHub Desktop.
curl_resolve: Resolves a URL unil it no longer redirects, dumps it's final URL.
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
#!/usr/bin/bash | |
if [[ $# < 1 ]]; then | |
echo "Resovles a URL unil it no longer redirects, dumps it's final URL." | |
echo "usage: curl_resolve <url>" | |
exit 2 | |
fi | |
MAX_REDIRECTS=3 | |
curl --max-redirs $MAX_REDIRECTS $1 -s -L -I -o /dev/null -w '%{url_effective}' | |
#vim: set sw=4 ts=4 et |
Author
moonexpr
commented
Sep 17, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment