the_earnest/dotfiles

- made bashrc add ./dotfiles/script to PATH

Commit ff50aaad8d25 · The Earnest · 2026-11-24 10:33 +0000

Changeset
ff50aaad8d2589f3dd3dfb74bdb477eee9ac8904

View source at this commit

- made bashrc add ./dotfiles/script to PATH
- improved logic for adding more paths

Comments

No comments yet.

Log in to comment

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()
 {