summaryrefslogtreecommitdiffstats
path: root/.local/bin/status
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2022-09-02 16:51:24 +0200
committerJoe <bousset.rudy@gmail.com>2022-09-02 16:51:24 +0200
commit17838e31561ee8ed2c1c44b03f0129406753e62d (patch)
tree3f3914faa11f7dfcc929f1901a56b6ed59fd1934 /.local/bin/status
parentup (diff)
downloaddotfiles-bsd-17838e31561ee8ed2c1c44b03f0129406753e62d.tar.gz
dotfiles-bsd-17838e31561ee8ed2c1c44b03f0129406753e62d.tar.bz2
dotfiles-bsd-17838e31561ee8ed2c1c44b03f0129406753e62d.tar.xz
dotfiles-bsd-17838e31561ee8ed2c1c44b03f0129406753e62d.tar.zst
dotfiles-bsd-17838e31561ee8ed2c1c44b03f0129406753e62d.zip
up
Diffstat (limited to '.local/bin/status')
-rwxr-xr-x.local/bin/status/sb-clock2
-rwxr-xr-x.local/bin/status/sb-forecast18
2 files changed, 8 insertions, 12 deletions
diff --git a/.local/bin/status/sb-clock b/.local/bin/status/sb-clock
index 6313e49..faecfc0 100755
--- a/.local/bin/status/sb-clock
+++ b/.local/bin/status/sb-clock
@@ -1,4 +1,4 @@
-#!/usr/local/bin/dash
+#!/bin/sh
clock=$(date '+%I')
diff --git a/.local/bin/status/sb-forecast b/.local/bin/status/sb-forecast
index 08b788d..413a280 100755
--- a/.local/bin/status/sb-forecast
+++ b/.local/bin/status/sb-forecast
@@ -1,20 +1,16 @@
#!/bin/sh
-weatherreport="/tmp/weatherreport"
-weatherglyph="/tmp/weatherglyph"
-moonglyph="/tmp/moonglyph"
+# weatherreport="/tmp/weatherreport"
+# weatherglyph="/tmp/weatherglyph"
+# moonglyph="/tmp/moonglyph"
-getweather() {
- curl -sf "wttr.in/Lyon" >$weatherreport || (rm -f $weatherreport && exit 1)
- curl -sf "wttr.in/Lyon?format=%c" >$weatherglyph || exit 1
- curl -sf "wttr.in/?format=%m" >$moonglyph || exit 1
-}
-
-[ -f $weatherreport ] && [ "$(gnustat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || getweather
+weatherreport=$(curl -sf "wttr.in/Lyon" 2>&1 || exit 1) # >$weatherreport || (rm -f $weatherreport && exit 1)
+weatherglyph=$(curl -sf "wttr.in/Lyon?format=%c" 2>&1 || exit 1) # >$weatherglyph || exit 1
+moonglyph=$(curl -sf "wttr.in/?format=%m" 2>&1 || exit 1) # >$moonglyph || exit 1
printf "%s%s" \
"$(cat $weatherglyph)" \
- "$(sed '16q;d' "$weatherreport" | grep -wo "[0-9]*%" | sort -rn | sed "s/^//g;1q" | tr -d '\n')" \
+ "$(sed '16q;d' "$weatherreport" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/ /g;1q" | tr -d '\n')"
sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' |
sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' |