From f75dacb50435e3c2a1078098c6c22fee19512eb8 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 10 Jan 2019 19:10:11 +0100 Subject: [PATCH] awesome-client: handle multiple args (#2551) `awesome-client 'return 1' 'return 2'` would only run the first command. This also fixes other issues reported by shellcheck, and uses `read` directly to allow `shellcheck` to parse that construct correctly. --- utils/awesome-client | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/awesome-client b/utils/awesome-client index 649f997ea..8bcbadc8d 100755 --- a/utils/awesome-client +++ b/utils/awesome-client @@ -17,12 +17,12 @@ then then if [ "$A_RERUN" = "" ] then - A_RERUN="no" exec $AWESOME_RLWRAP $0 "$@" + A_RERUN="no" exec "$AWESOME_RLWRAP" "$0" "$@" fi - READ_CMD="read" + READ_ARGS="" else # No rlwrap: use bash's readline. - READ_CMD="read -e" + READ_ARGS="-e" fi fi @@ -76,13 +76,13 @@ then fi done # run arguments - for arg in "$ARGS" ; do + for arg in "${ARGS[@]}"; do a_dbus_send "$arg" done elif [ -t 0 ] then FATAL_ERRORS=0 - while $READ_CMD -p "awesome# " -r line + while read $READ_ARGS -p "awesome# " -r line do if [ "$line" = "" ]; then continue