From 968ebffdde436b2a7b94a4352af09c10784d07f5 Mon Sep 17 00:00:00 2001 From: Kipras Melnikovas Date: Thu, 17 Jun 2021 17:49:30 +0300 Subject: [PATCH] fix sb-price: touch missing files fixed a case where on first run, the file will not exist and the `cat` inside `printf` in line 40 will show give an error instead of doing something useful --- .local/bin/statusbar/sb-price | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.local/bin/statusbar/sb-price b/.local/bin/statusbar/sb-price index 35b072fa..0608bad6 100755 --- a/.local/bin/statusbar/sb-price +++ b/.local/bin/statusbar/sb-price @@ -16,6 +16,8 @@ updateprice() { ping -q -c 1 example.org >/dev/null 2>&1 && curl -s "rate.sx/$1$interval" > "$chartfile" ;} [ -d "$dir" ] || mkdir -p "$dir" +[ -f "$pricefile" ] || touch "$pricefile" +[ -f "$chartfile" ] || touch "$chartfile" [ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && updateprice "$1"