two examples,
/home/x/.shrc
/home/x/.shrc
Code:
# Function to safely prepend a directory to PATH if it exists and isn't already there
path_add() {
if [ -d "$1" ]; then
case ":$PATH:" in
*":$1:"*) ;; # Already in PATH
*) PATH="$1:$PATH" ;;
esac
fi
}
export PATH=""
CUSTOM_PATHS="
/home/x/ADA/gnat2022-15.1.1/bin
$JAVA_HOME/bin
/home/x/.local/share/gem/ruby/3.3/bin
/home/x/.local/bin
/home/x/.local/share/coursier/bin
/home/x/.cargo/bin
/home/x/.dotnet/tools
/home/x/.acme.sh
/home/x/.roswell/lisp/quicklisp/bin
/home/x/.nimble/bin
/home/x/git/alire/bin
/home/x/git/DCD/bin
/home/x/git/serve-d
/home/x/git/crystalline/bin
/home/x/git/cppfront/source
/home/x/git/c3-lsp/server/bin
/home/x/git/zls/zig-out/bin
/home/x/git/pony-language-server/build/release
/home/x/git/ols
/home/x/git/clojure-lsp
/home/x/git/zls/zig-out/bin
/home/x/git/clojure-lsp/cli
/home/x/ldc2/ldc2/bin
/home/x/git/Odin
/home/x/config/doomemacs/bin
/usr/local/gnat12/bin
/usr/local/gnat13/bin
/usr/local/gerbil/bin
/usr/local/zig/bin
/usr/local/nim/bin
/home/x/bin
"
for dir in $CUSTOM_PATHS; do
path_add "$dir"
done
path_add "/usr/local/bin"
path_add "/usr/local/sbin"
path_add "/usr/bin"
path_add "/usr/sbin"
path_add "/usr/local/llvm21/bin"
path_add "/bin"
path_add "/sbin"
export PATH