aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/cd.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-06-20 22:51:35 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-06-20 22:51:35 +1200
commitbebbc9bb1c32f3f460ca6d6e81446fcc996dc9d6 (patch)
treeb10dfe3d6269550146c4d1184921f379cd79af83 /bash/bashrc.d/cd.bash
parentNix DISPLAY, otherwise don't change environment (diff)
downloaddotfiles-bebbc9bb1c32f3f460ca6d6e81446fcc996dc9d6.tar.gz
dotfiles-bebbc9bb1c32f3f460ca6d6e81446fcc996dc9d6.zip
Massive overhaul of structure for Bash files
* No longer using .bash_logout * No longer using .bash_profile, using POSIX-compliant .profile * instead; in particular, moved most of environment settings into .profile * Moved some of the separable functionality of both .profile and .bashrc into subdirectories (some scripts shared, some not) * Tidied implementation of ls/grep aliases * Updated install script to reflect all of the above
Diffstat (limited to 'bash/bashrc.d/cd.bash')
-rw-r--r--bash/bashrc.d/cd.bash11
1 files changed, 11 insertions, 0 deletions
diff --git a/bash/bashrc.d/cd.bash b/bash/bashrc.d/cd.bash
new file mode 100644
index 00000000..9154291b
--- /dev/null
+++ b/bash/bashrc.d/cd.bash
@@ -0,0 +1,11 @@
+# If given two arguments to cd, replace the first with the second in $PWD
+function cd {
+ if [[ -n "$2" ]]; then
+ builtin cd "${PWD/$1/$2}"
+ elif [[ -n "$1" ]]; then
+ builtin cd "$1"
+ else
+ builtin cd
+ fi
+}
+