Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- COUNT=0
- SUCCESS=0
- FAIL=0
- touch success.txt
- trap ctrl_c SIGINT SIGTERM
- function print_results() {
- echo
- echo "Succeeded: $SUCCESS, Failed: $FAIL, Total: $COUNT"
- }
- function ctrl_c() {
- print_results
- exit 0
- }
- while read id ; do
- ((COUNT++))
- if grep -Fxq "$id" success.txt; then
- ((SUCCESS++))
- continue
- fi
- echo -n "$COUNT: $id"
- output=`REPLACE_THIS_WITH_CURL --silent`
- if [[ ${PIPESTATUS[0]} -gt 0 ]]; then
- ((FAIL++))
- echo ", curl failed!"
- elif echo "$output" | grep -q 'has already been purchased.'; then
- ((SUCCESS++))
- echo ", succeeded - already owned!"
- echo $id >> success.txt
- elif echo "$output" | grep -q 'has been added to your assets.'; then
- ((SUCCESS++))
- echo ", succeeded!"
- echo $id >> success.txt
- elif echo "$output" | grep -q 'moving around data. The site will be right back.'; then
- ((FAIL++))
- echo ", failed - site will be right back"
- else
- ((FAIL++))
- echo ", failed - unknown error"
- fi
- sleep 5
- done
- print_results
Advertisement
Add Comment
Please, Sign In to add comment