aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--%HOME%/.bash_utils/path.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/%HOME%/.bash_utils/path.sh b/%HOME%/.bash_utils/path.sh
index 9a0e1a2..9f1fdd4 100644
--- a/%HOME%/.bash_utils/path.sh
+++ b/%HOME%/.bash_utils/path.sh
@@ -29,19 +29,20 @@ path_add() (
local -A dest_dict
local -a dest_list
+ for path in ${src_list[@]+"${src_list[@]}"}; do
+ [ -n "${dest_dict[$path]+x}" ] && continue
+ dest_dict[$path]=1
+ dest_list+=("$path")
+ done
+
if [ -n "${PATH-}" ]; then
while IFS= read -d '' -r path; do
+ [ -n "${dest_dict[$path]+x}" ] && continue
dest_dict[$path]=1
dest_list+=("$path")
done < <( str_split -z -- "${PATH-}" ':' | xargs -0 -- readlink -z --canonicalize-missing -- )
fi
- for path in ${src_list[@]+"${src_list[@]}"}; do
- [ -n "${dest_dict[$path]+x}" ] && continue
- dest_dict[$path]=1
- dest_list+=("$path")
- done
-
str_join ':' ${dest_list[@]+"${dest_list[@]}"}
)