aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-19 12:48:35 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-19 12:48:35 +1200
commit3d8cf05dfc685e799aa5e20319e8e33288e74e04 (patch)
tree28668e9ba83860c7a30cea5a2c5b80533121ae39 /bash/bashrc.d
parentFlag issue fixed (diff)
downloaddotfiles-3d8cf05dfc685e799aa5e20319e8e33288e74e04.tar.gz
dotfiles-3d8cf05dfc685e799aa5e20319e8e33288e74e04.zip
Change cd() into POSIX shell script
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/cd.bash32
1 files changed, 0 insertions, 32 deletions
diff --git a/bash/bashrc.d/cd.bash b/bash/bashrc.d/cd.bash
deleted file mode 100644
index 04de96d5..00000000
--- a/bash/bashrc.d/cd.bash
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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 arg
- local -a opts
- for arg ; do
- case $arg in
- --)
- shift
- break
- ;;
- -*)
- shift
- opts[${#opts[@]}]=$arg
- ;;
- *)
- break
- ;;
- esac
- done
- if (($# == 2)) ; then
- if [[ $PWD == *"$1"* ]] ; then
- builtin cd "${opts[@]}" -- "${PWD/"$1"/"$2"}"
- else
- printf 'bash: %s: could not replace substring\n' \
- "$FUNCNAME" >&2
- return 2
- fi
- else
- builtin cd "${opts[@]}" -- "$@"
- fi
-}