Last active
November 5, 2025 11:52
-
-
Save dewomser/37bee8b04be32a985489ee65cbdadd30 to your computer and use it in GitHub Desktop.
Get temperature from an API. Decide if hot or cold. A very short Bashscript
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 | |
| # Es geht auch ohne Variable a | |
| t=$(curl -s https://wetter.hs-worms.de/api/v3/data | jq '.temperature.out') | |
| t1=15 | |
| if [[ $t < $t1 ]]; then echo "Uh, this is cold !"; else echo "Uff,rather warm !"; fi |
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 | |
| t=$(curl -s https://wetter.hs-worms.de/api/v3/data | jq '.temperature.out') | |
| t1=15 | |
| a=$(echo "$t<$t1"|bc) | |
| #testa failed =$(( t<t1 )) | |
| if [[ $a -eq 1 ]]; then | |
| echo "Uh, this is cold !" | |
| else | |
| echo "Uff,rather warm !" | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vielen Dank für den Tipp 😃