aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2023-05-17 16:03:53 -0300
committerSilvio Rhatto <rhatto@riseup.net>2023-05-17 16:03:53 -0300
commit5c1fdba0ba84839fe944a655d26009f06760c0ed (patch)
tree4cf7572cc00b6af50e047d9d0c77330f55cc3a37
parent8487ec42b1819489702973a8686c364c3bb29541 (diff)
downloadprofile-5c1fdba0ba84839fe944a655d26009f06760c0ed.tar.gz
profile-5c1fdba0ba84839fe944a655d26009f06760c0ed.tar.bz2
Fix: organize and enhance docs/issues on CDPATH
-rw-r--r--profile.dot.link32
1 files changed, 20 insertions, 12 deletions
diff --git a/profile.dot.link b/profile.dot.link
index 44c57e2..2a6889d 100644
--- a/profile.dot.link
+++ b/profile.dot.link
@@ -138,14 +138,10 @@ export PATH=$PATH
#export WORKPATH="$HOME/file:$HOME/data:$HOME/code:$HOME/apps:$HOME/.dotfiles:$HOME/.dotfiles/modules"
export WORKPATH="$HOME/file:$HOME/data:$HOME/code:$HOME/apps:$HOME/apps/dotfiles/modules"
-# See http://www.caliban.org/bash/#bashtips
-if [ "$SETCDPATH" != "false" ]; then
- if [ -z "$CDPATH" ]; then
- export CDPATH=".:$HOME:$WORKPATH"
- else
- export CDPATH=".:$HOME:$WORKPATH:$CDPATH"
- fi
-fi
+# Expand workpath
+#for folder in `echo $WORKPATH | sed -e "s|:| |g" -e "s|~|$HOME|g"`; do
+# PROJECTS="$PROJECTS`ls -d $folder/*`"
+#done
# Default editor
#if [ ! -z "$DISPLAY" ]; then
@@ -156,12 +152,24 @@ fi
#fi
export EDITOR="vim"
-# Expand workpath
-#for folder in `echo $WORKPATH | sed -e "s|:| |g" -e "s|~|$HOME|g"`; do
-# PROJECTS="$PROJECTS`ls -d $folder/*`"
-#done
+# CDPATH configuration
+# See http://www.caliban.org/bash/#bashtips
+#
+# The following CDPATH behavior might trigger unexpected behaviors in some
+# programs. See example at https://github.com/alecmuffett/eotk/pull/113
+# Recommendation is that programs do their own fix (as nothing guarantees
+# the CDPATH won't be set).
+if [ "$SETCDPATH" != "false" ]; then
+ if [ -z "$CDPATH" ]; then
+ export CDPATH=".:$HOME:$WORKPATH"
+ else
+ export CDPATH=".:$HOME:$WORKPATH:$CDPATH"
+ fi
+fi
+# Buil-in "cd" command replacement avoiding echoing the CDPATH
# Based on http://superuser.com/questions/90535/how-do-i-turn-of-auto-echo-in-bash-when-i-cd
+# But please note that this workaround will not work for invoked programs (see comment above).
if [ "$0" = "bash" ]; then
cd() {
if [ -z "$*" ]; then