From eb7aa511fb0606f220f91cfecb287384498af7ff Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 9 Oct 2016 22:36:03 +0200 Subject: [PATCH] awesome-client: simplify/fix ISATTY usage (#1151) ISATTY was a bit confusing and can be replaced by `[ -t 0 ]`. Followup to 4ce1608. --- utils/awesome-client | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/utils/awesome-client b/utils/awesome-client index 10926d92..0e2445d0 100755 --- a/utils/awesome-client +++ b/utils/awesome-client @@ -5,10 +5,7 @@ # when used with "|tail". set -o pipefail -tty 2>&1 > /dev/null -ISATTY=$? - -if [ "$ISATTY" = 0 ] +if [ -t 0 ] # is a tty. then # rlwrap provides readline functionality for "read", which is more enhanced # than bash's "read" itself. @@ -42,6 +39,7 @@ DBUS_PATH=/ DBUS_DEST=org.naquadah.awesome.awful DBUS_METHOD=${DBUS_DEST}.Remote.Eval +FATAL_ERRORS=1 a_dbus_send() { $DBUS_SEND --dest=$DBUS_DEST --type=method_call --print-reply \ @@ -53,15 +51,14 @@ a_dbus_send() fi } -FATAL_ERRORS="$ISATTY" if [ $# -ne 0 ] then - FATAL_ERRORS="1" for arg in "$@" ; do a_dbus_send "$arg" done -elif [ "$ISATTY" = 0 ] +elif [ -t 0 ] then + FATAL_ERRORS=0 while $READ_CMD -p "awesome# " -r line do if [ "$line" = "" ]; then