diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2011-03-10 19:54:44 -0500 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2011-03-10 21:10:41 -0500 |
commit | 06c29bbd5d1ad0542d8de4a6661bd8366d9c56d5 (patch) | |
tree | 33ed8ecbff72b73a99711f24e6fa6e785d7587cd /examples/data/scripts/instance-select-wmii.sh | |
parent | bfbd8eaf428b8cf04c88cc7acdcf9230c82120b4 (diff) |
Quote variables which may contain spaces
Diffstat (limited to 'examples/data/scripts/instance-select-wmii.sh')
-rwxr-xr-x | examples/data/scripts/instance-select-wmii.sh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/data/scripts/instance-select-wmii.sh b/examples/data/scripts/instance-select-wmii.sh index b3a5a87..57ef0cb 100755 --- a/examples/data/scripts/instance-select-wmii.sh +++ b/examples/data/scripts/instance-select-wmii.sh @@ -16,26 +16,26 @@ DMENU_SCHEME="wmii" case "$1" in "list" ) - list= + list="" # get window id's of uzbl clients. we could also get the label in one shot but it's pretty tricky for i in $(wmiir read /tag/sel/index | grep uzbl |cut -d ' ' -f2); do - label=$(wmiir read /client/$i/label) + label="$(wmiir read /client/$i/label)" list="$list$i : $label\n" done - window=$(printf "$list\n" | $DMENU | cut -d ' ' -f1) + window="$(printf "$list\n" | $DMENU | cut -d ' ' -f1)" wmiir xwrite /tag/sel/ctl "select client $window" ;; "next" ) - current=$(wmiir read /client/sel/ctl | head -n 1) + current="$(wmiir read /client/sel/ctl | head -n 1)" # find the next uzbl window and focus it - next=$(wmiir read /tag/sel/index | grep -A 10000 " $current " | grep -m 1 uzbl | cut -d ' ' -f2) + next="$(wmiir read /tag/sel/index | grep -A 10000 " $current " | grep -m 1 uzbl | cut -d ' ' -f2)" if [ -n "$next" ]; then wmiir xwrite /tag/sel/ctl "select client $next" fi ;; "prev" ) - current=$(wmiir read /client/sel/ctl | head -n 1) - prev=$(wmiir read /tag/sel/index | grep -B 10000 " $current " | tac | grep -m 1 uzbl | cut -d ' ' -f2) + current="$(wmiir read /client/sel/ctl | head -n 1)" + prev="$(wmiir read /tag/sel/index | grep -B 10000 " $current " | tac | grep -m 1 uzbl | cut -d ' ' -f2)" if [ -n "$prev" ]; then wmiir xwrite /tag/sel/ctl "select client $prev" fi |