aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/ud.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-06-06 14:54:33 +1200
committerTom Ryder <tom@sanctum.geek.nz>2015-06-06 14:54:33 +1200
commitfdfe1fe72f8fe358d2b64ddc9e1b58dda4d3ba90 (patch)
tree75374be5bee4e0f36f3020958fb99e8fb46e4385 /bash/bashrc.d/ud.bash
parentAvoid command substitution inline declaration (diff)
downloaddotfiles-fdfe1fe72f8fe358d2b64ddc9e1b58dda4d3ba90.tar.gz
dotfiles-fdfe1fe72f8fe358d2b64ddc9e1b58dda4d3ba90.zip
Separate declaration from assignment
Diffstat (limited to 'bash/bashrc.d/ud.bash')
-rw-r--r--bash/bashrc.d/ud.bash9
1 files changed, 6 insertions, 3 deletions
diff --git a/bash/bashrc.d/ud.bash b/bash/bashrc.d/ud.bash
index 16a79cba..2428ba54 100644
--- a/bash/bashrc.d/ud.bash
+++ b/bash/bashrc.d/ud.bash
@@ -4,7 +4,8 @@ ud() {
# Check and save optional first argument, number of steps upward; default
# to 1 if absent
- local -i steps=${1:-1}
+ local -i steps
+ steps=${1:-1}
if ! ((steps > 0)) ; then
printf 'bash: %s: Invalid step count %s\n' "$FUNCNAME" "$1" >&2
return 2
@@ -12,7 +13,8 @@ ud() {
# Check and save optional second argument, target directory; default to
# $PWD (typical usage case)
- local dir=${2:-$PWD}
+ local dir
+ dir=${2:-$PWD}
if [[ ! -e $dir ]] ; then
printf 'bash: %s: Target dir %s does not exist\n' "$FUNCNAME" "$2" >&2
return 1
@@ -31,7 +33,8 @@ ud() {
# Completion is only useful for the second argument
_ud() {
if ((COMP_CWORD == 2)) ; then
- local word=${COMP_WORDS[COMP_CWORD]}
+ local word
+ word=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -A directory -- "$word" ) )
else
return 1