Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # a bash script to use curl to post, as a response to a question asked by the Neurolove facebook page:
- # https://www.facebook.com/neurolove.me/posts/549604611804237
- # curl line adopted from the script by Andrea Olivato at:
- # http://andreaolivato.tumblr.com/post/108364451/post-to-tumblr-via-bash-using-curl
- # -Tye
- # check if we were interrupted last time
- if [ -f lastcount ]; then
- # yes, start where we left off
- . lastcount
- fi
- while read title content; do
- # check if we should skip this line because we were interrupted
- if [ "$lastcount" -gt "$currentcount" ]; then
- # yes
- currentcount=$(( currentcount + 1 ))
- continue
- fi
- # no, send post as the user in var1 using the password in var2
- curl -s -o /dev/null -d email="$1"&password="$2"&type=regular&title="$title"&body="$content"&generator=Bash
- # delay our next post by the number of seconds defined in var3
- sleep "$3"
- # advance our count by 1
- lastcount=$(( lastcount + 1 ))
- currentcount="$lastcount"
- # echo our count into our file, in case we're interrupted
- echo "lastcount=$lastcount" > lastcount
- # substitute our input for the file specified in var4
- done < <(cat "$4")
- # we're finished, remove our count file
- rm lastcount
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement