alexanderepstein / Bash-Snippets

A collection of small bash scripts for heavy terminal users
MIT License
9.64k stars 842 forks source link

Weather Script not Working #149

Closed navanchauhan closed 6 years ago

navanchauhan commented 6 years ago

Issue Label:

Description: Shows no output

If its a bug make sure to include this section.

OS and OS version:

OS Version: Kali Linux 2017

Screenshot : Screenshot

retokromer commented 6 years ago

FYI: On my Ubuntu 16.04 LTS is works fine.

navanchauhan commented 6 years ago

@retokromer @alexanderepstein I tried it yesterday on Parrot Sec OS, it didn't work. Today I installed Kali and still it doesn't work

navanchauhan commented 6 years ago

output with set -x

+ currentVersion=1.20.0
+ LANG=C.UTF-8
++ echo C.UTF-8
++ cut -c1-2
+ locale=C.
+ configuredClient=
+ getConfiguredClient
+ command -v curl
+ configuredClient=curl
+ getopts uvh opt
+ [[ 0 == \0 ]]
+ checkInternet
+ httpGet github.com
+ getIPWeather
++ httpGet ipinfo.io/country
++ case "$configuredClient" in
++ curl -A curl -s ipinfo.io/country
+ country=IN
+ [[ IN == \U\S ]]
++ httpGet ipinfo.io/loc
++ case "$configuredClient" in
++ curl -A curl -s ipinfo.io/loc
+ location=28.6833,77.0667
+ httpGet C..wttr.in/28.6833,77.0667
+ case "$configuredClient" in
+ curl -A curl -s C..wttr.in/28.6833,77.0667
+ exit 1
navanchauhan commented 6 years ago

@alexanderepstein My OSes did not have values for locale Recommend replacing $locale with $country (Got it working after doing this)

alexanderepstein commented 6 years ago

Huh I am not sure why your locale is just being set to C. when I echo $LANG I get en_US.UTF-8 the idea is to get your countries version of the weather in terms of language ex. curl fr.wttr.in outputs the weather in french. I guess I can check if the locale has not been set to something valid and just set it to en but this is more of a workaround rather than a fix.

alexanderepstein commented 6 years ago

Fixed with commit 47e91be373e2099f22e2e9a06c3fb0603f70414a