File tree Expand file tree Collapse file tree 2 files changed +2
-19
lines changed Expand file tree Collapse file tree 2 files changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ fetch_weather_information()
4242# get weather display
4343display_weather ()
4444{
45-   fahrenheit=$1 
4645  if  $fahrenheit ;  then 
4746    display_weather=' &u' #  for USA system
4847  else 
@@ -74,24 +73,13 @@ forecast_unicode()
7473  fi 
7574}
7675
77- export  -f display_weather
78- export  -f display_location
79- export  -f forecast_unicode
80- export  -f fetch_weather_information
81- 
8276main ()
8377{
8478  #  process should be cancelled when session is killed
8579  if  timeout 1 bash -c " </dev/tcp/ipinfo.io/443" &&  timeout 1 bash -c " </dev/tcp/wttr.in/443" ;  then 
86-     if  !  weather=$( timeout 3 bash -c " display_weather $fahrenheit " ) ;  then 
87-       echo  " Weather Unavailable" 
88-     elif  !  location=$( timeout 3 bash -c display_location) ;  then 
89-       echo  " Location Unavailable" 
90-     else 
91-       echo  " ${weather}${location} " 
92-     fi 
80+     echo  " $( display_weather) $( display_location) " 
9381  else 
94-     echo  " Network Error " 
82+     echo  " Weather Unavailable " 
9583  fi 
9684}
9785
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ fixedlocation=$3
1111DATAFILE=/tmp/.dracula-tmux-data
1212LAST_EXEC_FILE=" /tmp/.dracula-tmux-weather-last-exec" 
1313RUN_EACH=1200
14- RETRY_EACH=60
1514TIME_NOW=$( date +%s) 
1615TIME_LAST=$( cat " ${LAST_EXEC_FILE} " 2> /dev/null ||  echo  " 0" ) 
1716
@@ -23,10 +22,6 @@ main()
2322    #  Run weather script here
2423    $current_dir /weather.sh $fahrenheit  $location  " $fixedlocation " >  " ${DATAFILE} " 
2524    echo  " ${TIME_NOW} " >  " ${LAST_EXEC_FILE} " 
26-   elif  grep -q ' Unavailable\|Error' " ${DATAFILE} " &&  [ " $( expr ${TIME_LAST}  + ${RETRY_EACH} ) " -lt  " ${TIME_NOW} " ;  then 
27-     #  Run weather script here
28-     $current_dir /weather.sh $fahrenheit  $location  " $fixedlocation " >  " ${DATAFILE} " 
29-     echo  " ${TIME_NOW} " >  " ${LAST_EXEC_FILE} " 
3025  fi 
3126
3227  cat " ${DATAFILE} " 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments