dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

weather (369B)


      1 #!/bin/sh
      2 
      3 weather() {
      4 	local -r location="$(curl -s "https://ipvigilante.com/" | jq -r '.data.city_name')"
      5 	wttr=$(curl -s "wttr.in/${location}?format=%l:+%f+%C\n" | tr '[:upper:]' '[:lower:]')
      6 	if [[ ${wttr} == "unknown location"* ]] ; then
      7 		echo -e "weather is ${light_red}unavailable${reset}" > /tmp/weather
      8 	else
      9 		echo -e "${wttr}" > /tmp/weather
     10 	fi
     11 }
     12 
     13 weather