Created
June 21, 2017 15:45
-
-
Save aqlx86/0304d3159bba054c683b97c63c80093a 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 | |
set -e | |
echo "Attempting to get the weather of Pasig City..." | |
URL='http://www.accuweather.com/en/ph/pasig/264876/weather-forecast/264876' | |
pasig="$(wget -q -O- "$URL" | awk -F\' '/acm_RecentLocationsCarousel\.push/{print $10"°" }'| head -1 | sed -e "s/^.* //")" | |
tc=$(echo $pasig | cut -c 1-2) | |
tf=$(echo "scale=1;((9/5) * $tc) + 32" |bc) | |
tf=$(echo $tf | cut -d"." -f1)"°F" | |
pasig=$pasig"C/"$tf | |
echo -e $pasig | |
echo -e $pasig > ~/pasigtemp.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment