5 DIR_DATA
="$HOME/var/run/today"
6 FILE_WEATHER
="$DIR_DATA/weather"
13 awk -v x
="$x" -v n
="$n" 'BEGIN {for (i=1; i<=n; i++) {printf x}}'
16 bar
=$
(repeat
'-' '80')
17 ts_fmt
='+%A, %Y %B %d, %H:%M:%S'
19 timestamp_local
=$
(LANG
="$ts_lang" date "$ts_fmt")
20 timestamp_west
=$
( LANG
="$ts_lang" TZ
='US/Pacific' date "$ts_fmt")
21 timestamp_pl
=$
( LANG
="$ts_lang" TZ
='Poland' date "$ts_fmt")
22 timestamp_nz
=$
( LANG
="$ts_lang" TZ
='NZ' date "$ts_fmt")
29 sub(":$", "", interface)
30 interfaces[++interface_count] = interface
35 sub("/[0-9]+$", "", addr)
36 addrs[interface] = addr
40 for (i=1; i<=interface_count; i++) {
41 interface = interfaces[i]
42 print interface, addrs[interface]
49 curl
"http://wttr.in/${ZIP_CODE}?1" \
55 echo $
(( $
(date +%s
) - $
(stat
-c '%Y' "$FILE_WEATHER") ))
58 weather_get_or_fetch
() {
59 weather_file_age_limit
=$
(( 3 * 60 * 60 ))
60 if [[ ! -e $FILE_WEATHER || weather_file_age
-ge $weather_file_age_limit ]]
67 weather
="$(weather_get_or_fetch)"
70 #LANG="$ts_lang" ncal -M $(date +%Y)
71 LANG
="$ts_lang" ncal
-M
74 echo 'LOCAL' ',' "$timestamp_local"
75 echo 'Pacific' ',' "$timestamp_west"
76 echo 'Poland' ',' "$timestamp_pl"
77 echo 'New Zealand' ',' "$timestamp_nz"
84 echo "Fetched on: $(stat -c %y $FILE_WEATHER)"
This page took 0.077981 seconds and 4 git commands to generate.