Wow, it might actually work! I can’t believe I got this lucky on the first try!
Well, sorta. Basically, I tested a few post earlier buy using curl
to post new topics. That was so straightforward, I decided to just go for it, once I figured out how to loop through a file, in this case one containing the name of an item I have in Steam, on each line. Here is my gameon.sh
:
#!/usr/bin/bash
filename="$1"
while read -r game; do
curl -X POST -d title="Discover $game" -d raw="This quest to discover $game was automagically added, as described at http://archive.v1.talkgroup.xyz/t/im-gonna-do-a-silly-thing-that-adds-hundreds-of-posts-to-the-quest-board/1464 ^_^" -d category="21" http://archive.v1.talkgroup.xyz/posts?api_key=XXXXXX&api_username=maiki ; sleep 3 ;
done < "$filename"
And that’s it, really.
Reading:
- For and Read-While Loops in Bash
- shell - curl url call in for loop? - Unix & Linux Stack Exchange
- IFS - Greg's Wiki (didn’t use in this case, but crazy powerful!)
- bash - Read a file line by line assigning the value to a variable - Stack Overflow
- BashFAQ/001 - Greg's Wiki
- Bash for loop
- linux - Looping through the content of a file in Bash - Stack Overflow
- Linux and Curl: How to use Bash to Read a File Line by Line and Execute Curl command to get HTTP Response Code • Crunchify