aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-09-01 12:05:33 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-09-01 12:05:33 -0300
commit7d222b2f6321b49c04a617a36c5dc694eddd5067 (patch)
tree63941ad580c2991f8aaf029759a09c224239f51a
parent2eb80be0fe39516a5625d168524dc92ae5b407ce (diff)
downloadprofile-7d222b2f6321b49c04a617a36c5dc694eddd5067.tar.gz
profile-7d222b2f6321b49c04a617a36c5dc694eddd5067.tar.bz2
Enhanced cd builtin
-rw-r--r--profile.dot.link11
1 files changed, 10 insertions, 1 deletions
diff --git a/profile.dot.link b/profile.dot.link
index 4bb131a..e5f280b 100644
--- a/profile.dot.link
+++ b/profile.dot.link
@@ -31,7 +31,7 @@ export PATH=$PATH
# See http://www.caliban.org/bash/#bashtips
export CDPATH=".:~:~/code:~/data:~/file:~/apps:/var/www/data"
-# See http://superuser.com/questions/90535/how-do-i-turn-of-auto-echo-in-bash-when-i-cd
+# Based on http://superuser.com/questions/90535/how-do-i-turn-of-auto-echo-in-bash-when-i-cd
cd() {
if [ -z "$*" ]; then
destination=~
@@ -39,7 +39,16 @@ cd() {
destination=$*
fi
+ # Check if its a project under CPATH
+ project=`command cd "${destination}" 2> /dev/null`
+
+ # Got to folder
command cd "${destination}" > /dev/null
+
+ # Update screen title
+ if [ ! -z "$project" ] && [ ! -z "$STY" ]; then
+ stitle `basename $project`
+ fi
}
# Default editor