aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/cd.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-09-01 00:48:44 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-09-01 00:48:44 +1200
commit11a6ae1b208691b9f894ef172c267004cace81e6 (patch)
tree128344a8d6cea9bee9add353cb75b6c025f68c40 /bash/bashrc.d/cd.bash
parentFix incorrect array index for VCS states (diff)
downloaddotfiles-11a6ae1b208691b9f894ef172c267004cace81e6.tar.gz
dotfiles-11a6ae1b208691b9f894ef172c267004cace81e6.zip
More sensible use of local
Don't declare integers/arrays, just use them. Also includes a minor scope fix -- don't need to count number of colors on every call to prompt(), just for `prompt on`.
Diffstat (limited to 'bash/bashrc.d/cd.bash')
-rw-r--r--bash/bashrc.d/cd.bash3
1 files changed, 1 insertions, 2 deletions
diff --git a/bash/bashrc.d/cd.bash b/bash/bashrc.d/cd.bash
index edc5c6f1..0f1eba24 100644
--- a/bash/bashrc.d/cd.bash
+++ b/bash/bashrc.d/cd.bash
@@ -1,8 +1,7 @@
# If given two arguments to cd, replace the first with the second in $PWD,
# emulating a Zsh function that I often find useful; preserves options too
cd() {
- local OPTIND=0 opt
- local -a opts
+ local opt opts OPTIND=0
while getopts elP opt; do
opts[${#opts[@]}]=-$opt
done