Created
July 22, 2014 22:35
-
-
Save jtbrough/54968c685fc28d00eda5 to your computer and use it in GitHub Desktop.
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 | |
filename=~/path/to/shortened_input.txt | |
exec 4<$filename | |
while read -u4 p ; do | |
expanded=$(curl -sI $p | sed -n 's/Location: *//p') | |
if [ ${#expanded} > 0 ] | |
then | |
echo $expanded >> ~/path/to/expanded_output.txt; | |
else | |
echo $p >> ~/path/to/expanded_output.txt; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment