the_earnest/dotfiles
- made bashrc add ./dotfiles/script to PATH
Commit ff50aaad8d25 · The Earnest · 2026-11-24 10:33 +0000
- made bashrc add ./dotfiles/script to PATH - improved logic for adding more paths
Comments
No comments yet.
Diff
diff --git a/bashrc b/bashrc
--- a/bashrc
+++ b/bashrc
@@ -172,12 +172,17 @@
PS1='\[\e[0;32m\]\w\[\e[0m\] \[\e[0;97m\]\n\$\[\e[0m\] '
-# append ~/bin to PATH if it's not already in PATH
-#ZZ=$(echo $PATH | grep -o ~/bin)
-#[[ -z "$ZZ" ]] && PATH=$PATH:~/bin
-if [[ ! "$PATH" =~ "$HOME/bin" ]]; then
- PATH=$PATH:~/bin
-fi
+# append certain dirs to PATH
+pathdirs=(
+~/.dotfiles/scripts
+~/bin
+)
+for pathdir in "${pathdirs[@]}"
+do
+ if [[ -d "$pathdir" && ! "$PATH" =~ "$pathdir" ]]; then
+ PATH=$PATH:"$pathdir"
+ fi
+done
function seen()
{