Created
December 3, 2018 14:51
-
-
Save Frisch12/a52201c4eb989b5bc570ebf93ddb7c51 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| if [ -z ${2+x} ]; then | |
| day=$(date +%d) | |
| day=$(echo $day | sed 's/^0*//') | |
| else | |
| day=$2 | |
| if [ "$day" = "all" ]; then | |
| today=$(date +%d) | |
| for i in $(seq $today); do | |
| $0 $1 $i | |
| done | |
| exit | |
| fi | |
| fi | |
| winner=$(curl -s http://www.tboecker-it.de/rotary/days/$day/ | pup ".info p:not(.mittags) json{}" | jq "[.[] | {text: .text, winner: .children[].children[]?.text | split(\",\") | .[] | [ltrimstr(\" \") | rtrimstr(\" \")]} | if .winner[] == \"$1\" then .text else \"\" end] | join(\"\")" -r) | |
| if [[ $winner == *"-"* ]]; then | |
| echo "Gewonnen am $day.12. Preis: $winner" | |
| else | |
| echo "Nicht gewonnen am $day.12." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment