File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,17 @@ display_weather()
5353  temperature=$( echo $weather_information  |  rev |  cut -d '  ' |  rev) #  +31°C, -3°F, etc
5454  unicode=$( forecast_unicode $weather_condition ) 
5555
56-   echo  " $unicode  ${temperature/ +/ } " #  remove the plus sign to the temperature
56+   #  Mac Only variant should be transparent on Linux
57+   if  [[ " ${temperature/ +/ } " ==  * " ====" *  ]];  then 
58+     temperature=" error" 
59+   fi 
60+ 
61+   if  [[ " ${temperature/ +/ } " ==  " error" ;  then 
62+     #  Propagate Error
63+     echo  " error" 
64+   else 
65+     echo  " $unicode  ${temperature/ +/ } " #  remove the plus sign to the temperature
66+   fi 
5767}
5868
5969forecast_unicode ()
@@ -76,7 +86,7 @@ forecast_unicode()
7686main ()
7787{
7888  #  process should be cancelled when session is killed
79-   if  timeout 1 bash -c " </dev/tcp/ipinfo.io/443" &&  timeout 1 bash -c " </dev/tcp/wttr.in/443" ;  then 
89+   if  timeout 1 bash -c " </dev/tcp/ipinfo.io/443" &&  timeout 1 bash -c " </dev/tcp/wttr.in/443"   &&  [[  " $( display_weather ) "   !=   " error "  ]] ;  then 
8090    echo  " $( display_weather) $( display_location) " 
8191  else 
8292    echo  " Weather Unavailable" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments