From 3cfd9f0d436ce5373422221c4e2b86de073acf8d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 20 Nov 2016 20:42:29 -0500 Subject: [PATCH] os/arch panel-notify: refactor --- os/arch/.config/panel/panel-notify | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/os/arch/.config/panel/panel-notify b/os/arch/.config/panel/panel-notify index 3ecf56b3..eb7919b7 100755 --- a/os/arch/.config/panel/panel-notify +++ b/os/arch/.config/panel/panel-notify @@ -1,36 +1,29 @@ #!/usr/bin/env bash -CWD=$(cd $(dirname $0) && pwd -P) - -if [ -t 0 ] -then - if [ "$#" -eq 0 ] - then +CWD=$(dirname $0) +if [[ -t 0 ]]; then + if (( $# == 0 )); then >&2 echo "Usage: panel_update.sh [LEMON_TO_UPDATE]" exit 1 fi - case "$1" in + case $1 in :*) LEMON="$CWD/lemons/${1#?}" - if [ ! -f "$LEMON" ] - then + if [[ ! -f $LEMON ]]; then >&2 echo "Couldn't find that lemon ($1)" exit 2 fi - . $CWD/panel-config - pkill -f "bash \./lemons/${1#?}" - pushd "$CWD" >/dev/null - $LEMON > "$PANEL_FIFO" & - popd >/dev/null + . "$CWD/panel-config" + pkill -f "[bd]ash .+/lemons/${1#?}" + "$LEMON" > "$PANEL_FIFO" & ;; *) echo "$@" | $0 ;; esac else . $CWD/panel-config - while read -r line - do + while read -r line; do echo "$line" > "$PANEL_FIFO" & done fi