Browse Source

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.
Daniel Hahler 11 months ago
parent
commit
f75dacb504
No account linked to committer's email address
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      utils/awesome-client

+ 5
- 5
utils/awesome-client View File

@@ -17,12 +17,12 @@ then
17 17
     then
18 18
         if [ "$A_RERUN" = "" ]
19 19
         then
20
-            A_RERUN="no" exec $AWESOME_RLWRAP $0 "$@"
20
+            A_RERUN="no" exec "$AWESOME_RLWRAP" "$0" "$@"
21 21
         fi
22
-        READ_CMD="read"
22
+        READ_ARGS=""
23 23
     else
24 24
         # No rlwrap: use bash's readline.
25
-        READ_CMD="read -e"
25
+        READ_ARGS="-e"
26 26
     fi
27 27
 fi
28 28
 
@@ -76,13 +76,13 @@ then
76 76
         fi
77 77
     done
78 78
     # run arguments
79
-    for arg in "$ARGS" ; do
79
+    for arg in "${ARGS[@]}"; do
80 80
         a_dbus_send "$arg"
81 81
     done
82 82
 elif [ -t 0 ]
83 83
 then
84 84
     FATAL_ERRORS=0
85
-    while $READ_CMD -p "awesome# " -r line
85
+    while read $READ_ARGS -p "awesome# " -r line
86 86
     do
87 87
         if [ "$line" = "" ]; then
88 88
             continue

Loading…
Cancel
Save