Created
June 27, 2012 22:32
-
-
Save J2R5M3/3007322 to your computer and use it in GitHub Desktop.
Reddit bash script
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 | |
function RedditDir { | |
if [ -d ~/reddit ] | |
then | |
cd ~/reddit | |
else | |
mkdir ~/reddit | |
cd ~/reddit | |
fi | |
} | |
function getlinks { | |
echo "what subreddit do you want?" | |
read reddit | |
mkdir $reddit"["`date +%e-%m-%y`"]" | |
cd $reddit[`date +%e-%m-%y`] | |
wget -q reddit.com/r/$reddit.rss | |
grep -o imgur.com/..... $reddit.rss > links.txt | |
rm $reddit.rss | |
} | |
function getimg { | |
COUNTER=0 | |
cat links.txt | while read line; do | |
let COUNTER=COUNTER+1 | |
wget -q $line.gif | |
echo "getting image" $COUNTER | |
done | |
rm links.txt | |
} | |
function main { | |
RedditDir | |
echo "Welcome to J2R5M's Reddit downloading script!" | |
getlinks | |
getimg | |
exit | |
} | |
function exit { | |
exit 0 | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[1] 13223 segmentation fault (core dumped)