From 10fe774027ba3b5230809a142a499802f977360b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 6 Jan 2015 13:17:14 -0500 Subject: wmii: mark local variables as local --- .config/wmii-hg/config.sh | 19 ++++++++++--------- .config/wmii-hg/util.sh | 9 +++++---- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.config/wmii-hg/config.sh b/.config/wmii-hg/config.sh index c560f3f..437c585 100644 --- a/.config/wmii-hg/config.sh +++ b/.config/wmii-hg/config.sh @@ -13,7 +13,7 @@ mkdir -p -- "${HIST%/*}" . theme-tango-dark Event() { - event=$1; shift; + local event=$1; shift; case "$event" in ## Mouse event meanings: ## MouseDown = mouse down @@ -42,7 +42,7 @@ Event() { # Clear the LBar and RBar find $WMII_DIR/{l,r}bar -type f -delete # Populate the LBar by emulating [Create|Focus]Tag events - seltag=`sed 1q $WMII_DIR/tag/sel/ctl` + local tag seltag="$(sed 1q $WMII_DIR/tag/sel/ctl)" while read -r tag; do Event CreateTag "$tag" if [ "$tag" = "$seltag" ]; then @@ -99,14 +99,14 @@ Event() { NotUrgent) ## $1=client $2=[Manager|Client] ;; ClientMouseDown) ## $1=client $2=button - client=$1 - button=$2 + local client=$1 + local button=$2 case $button in 1) ;; 2) ;; 3) { - case `wmii9menu Delete Fullscreen` in + case $(wmii9menu Delete Fullscreen) in Delete) echo kill >> $WMII_DIR/client/$client/ctl;; Fullscreen) @@ -117,8 +117,9 @@ Event() { ClientClick) ## $1=client $2=button ;; Unresponsive) ## $1=client - client=$1 - client_name=`cat $WMII_DIR/client/$client/label` + local client=$1 + local client_name=$(< $WMII_DIR/client/$client/label) + local msg resp msg="The client \`${client_name}' is not responding." msg+=" What would you like to do?" { @@ -166,7 +167,7 @@ Event() { } Key() { - key=$1 + local key=$1 case "$key" in ## Moving around @@ -239,7 +240,7 @@ Key() { } Action() { - prog=$(path_which "$WMII_CONFPATH" "$1"); shift + local prog=$(path_which "$WMII_CONFPATH" "$1"); shift if [ -n "$prog" ]; then "$prog" "$@" else diff --git a/.config/wmii-hg/util.sh b/.config/wmii-hg/util.sh index 2211d28..323d8a6 100644 --- a/.config/wmii-hg/util.sh +++ b/.config/wmii-hg/util.sh @@ -25,11 +25,12 @@ dquote() { # Usage: expand_variables # Expands variables read from /dev/stdin ## -expand_variables() { - while read; do - eval printf "'%s\n'" "$(dquote "$REPLY")" +expand_variables() ( + IFS='' + while read -r line; do + eval printf "'%s\n'" "$(dquote "$line")" done -} +) is_mounted() { local dir="$(readlink -m $1)" -- cgit v1.2.3-54-g00ecf