14 lines
233 B
Text
14 lines
233 B
Text
|
#!/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%:}"
|