dotfiles/arch/bin/consolidate-path
2022-08-24 04:07:33 -04:00

13 lines
233 B
Bash
Executable file

#!/bin/bash
# Usage: PATH="$(consolidate-path "$PATH")"
#
# Remove duplicate entries from PATH.
result=":"
IFS=:
for p in $1; do
[[ "$result" == *:"$p":* ]] || result="${result}${p}:"
done
result="${result#:}"
echo "${result%:}"