Skip to content

Instantly share code, notes, and snippets.

@aqlx86
Created June 21, 2017 15:45
Show Gist options
  • Save aqlx86/0304d3159bba054c683b97c63c80093a to your computer and use it in GitHub Desktop.
Save aqlx86/0304d3159bba054c683b97c63c80093a to your computer and use it in GitHub Desktop.
#!/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