commit: 3d3bc624f853d5f1d6feb6c7109b5523c77b54bf
parent: 6dc013c60bfa73be20a7520e1e32186e9e170594
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Wed, 23 Aug 2017 23:39:31 +0200
bin/{memsys,timey-whyme}.sh: Fix problems found by ShellCheck
Diffstat:
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/bin/memsys.sh b/bin/memsys.sh
@@ -1,4 +1,4 @@
#!/bin/sh
locker='slock'
-su -c "su -c $locker $(id -u -nr) & echo mem > /sys/power/state" $(id -u -nr 0)
+su -c "su -c $locker $(id -u -nr) & echo mem > /sys/power/state" "$(id -u -nr 0)"
diff --git a/bin/timey-whyme.sh b/bin/timey-whyme.sh
@@ -1,19 +1,17 @@
#!/bin/sh
# Copyright CC-BY-SA-4.0 2017- Haelwenn (lanodan) Monnier <contact@hacktivis.me>
-xdd="${XDG_DATA_DIR:-$HOME/.local/share}/timey-whyme"
-today=$(date --date=${2:-now} +%Y-%m-%d)
-later=$(date --date=${2:-+7days} +%Y-%m-%d)
-heading='\t[1;32m%s[0m\n'
-highlight='[1;34m%s[0m'
-form='column -s, -o -t'
+ xdd="${XDG_DATA_DIR:-$HOME/.local/share}/timey-whyme"
+today="$(date --date=now +%Y-%m-%d)"
+later="$(date --date=+7days +%Y-%m-%d)"
+ form='column -s, -o -t'
usage() {
printf "Usage: [[all|both|cal|todo]\n"
}
verify_xxd() {
- [ -e ${xdd}/$1 ] || echo "Please create a file a the following, see examples for help: ${xdd}/${1}"
+ [ -e "${xdd}/${1}" ] || echo "Please create a file a the following, see examples for help: ${xdd}/${1}"
}
todo() {
@@ -21,7 +19,7 @@ todo() {
echo ",0,###[1;32m, To Do, ###[0m
${today},[1;34m###, Now +7 days, ###
${later},[0m###, Later,###[1m
-$(grep -v '^#' $xdd/todo.csv)[0m" | sort -n | $form
+$(grep -av '^#' "$xdd/todo.csv")[0m" | sort -n | $form
}
calendar() {
@@ -29,7 +27,7 @@ calendar() {
echo "0000-00-00,###[1;32m, Calendar, ###[0m
${today},[1;34m###, Now +7 days, ###
${later},[0m###, Later,###[1m
-$(grep -v '^#' $xdd/calendar.csv)[0m" | sort -n | $form
+$(grep -av '^#' "$xdd/calendar.csv")[0m" | sort -n | $form
}
case "$1" in