summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh')
-rw-r--r--sh/profile82
1 files changed, 29 insertions, 53 deletions
diff --git a/sh/profile b/sh/profile
index c37bc48..07f51f5 100644
--- a/sh/profile
+++ b/sh/profile
@@ -83,63 +83,39 @@ export BLENDER_3_0="/usr/bin/blender"
export SRCDIR="$HOME/.local/src"
# OLD PATH
-export SYSPATH="$PATH"
+export PATHS="$(echo "$PATH" | sed 's/:/\n/g')"
+USERPATH=""
-# NEW PATH
addtopath () {
- if [ -n "$PATH" ]; then
- PATH="$@:$PATH"
- else
- PATH="$@"
- fi
+ local USERPATHS="$(echo "$USERPATH" | sed 's/:/\n/g')"
+ if [ -d "$1" ]; then
+ echo "$PATHS" | /usr/bin/grep -qE "^$1$" && return
+ echo "$USERPATHS" | /usr/bin/grep -qE "^$1$" && return
+ [ -n "$USERPATH" ] && USERPATH="${USERPATH}:"
+ USERPATH="${USERPATH}$1"
+ fi
}
-unset PATH
-if [ -d "$HOME/.local/bin/testing" ]; then
- addtopath "$HOME/.local/bin/testing"
-fi
-if [ -d "$HOME/.local/bin/shortcmds" ]; then
- addtopath "$HOME/.local/bin/shortcmds"
-fi
-if [ -d "$HOME/.local/bin/generics" ]; then
- addtopath "$HOME/.local/bin/generics"
-fi
-if [ -d "$HOME/.local/bin/scripts" ]; then
- addtopath "$HOME/.local/bin/scripts"
-fi
-if [ -d "$HOME/.local/bin/sp" ]; then
- addtopath "$HOME/.local/bin/sp"
-fi
-if [ -d "$HOME/.local/bin/blocks" ]; then
- addtopath "$HOME/.local/bin/blocks"
-fi
-if [ -d "$HOME/.local/bin/ignore" ]; then
- addtopath "$HOME/.local/bin/ignore"
-fi
-if [ -d "$HOME/.local/bin/volsv" ]; then
- PATH="$PATH:$HOME/.local/bin/volsv"
-fi
-if [ -d "$HOME/.local/bin" ]; then
- addtopath "$HOME/.local/bin"
-fi
-if [ -d "$HOME/.local/bin/flatpak-sc" ]; then
- addtopath "$HOME/.local/bin/flatpak-sc"
-fi
-if [ -d "$HOME/.local/bin/flatpak/exports/bin" ]; then
- addtopath "$HOME/.local/share/flatpak/exports/bin/"
-fi
-if [ -d "$CARGO_HOME/bin" ]; then
- addtopath "$CARGO_HOME/bin"
-fi
-if [ -d "$GOPATH/bin" ]; then
- addtopath "$GOPATH/bin"
-fi
-if [ -d "/var/lib/flatpak/exports/bin" ]; then
- addtopath "/var/lib/flatpak/exports/bin"
-fi
+addtopath "$HOME/.local/bin/testing"
+addtopath "$HOME/.local/bin/shortcmds"
+addtopath "$HOME/.local/bin/generics"
+addtopath "$HOME/.local/bin/scripts"
+addtopath "$HOME/.local/bin/sp"
+addtopath "$HOME/.local/bin/blocks"
+addtopath "$HOME/.local/bin/ignore"
+addtopath "$HOME/.local/bin/volsv"
+addtopath "$HOME/.local/bin"
+addtopath "$HOME/.local/bin/flatpak-sc"
+addtopath "$HOME/.local/share/flatpak/exports/bin/"
+addtopath "$CARGO_HOME/bin"
+addtopath "$GOPATH/bin"
+addtopath "$ZVMPATH"
+addtopath "$ZVM_INSTALL"
+addtopath "/var/lib/flatpak/exports/bin"
# MERGE PATHS
-export PATH="$PATH:$SYSPATH"
+[ -n "$USERPATH" ] && export PATH="$USERPATH:$PATH"
-# CLEANUP
-unset SYSPATH
+unset -f addtopath
+unset USERPATH
+unset PATHS