Skip to content

Instantly share code, notes, and snippets.

@J2R5M3
Created June 27, 2012 22:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save J2R5M3/3007322 to your computer and use it in GitHub Desktop.
Save J2R5M3/3007322 to your computer and use it in GitHub Desktop.
Reddit bash script
#!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
@paullucas
Copy link

[1] 13223 segmentation fault (core dumped)

@evannoronha
Copy link

[1] should be #!/bin/bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment