path functions: remove duplicate
This commit is contained in:
@@ -383,6 +383,12 @@ function path_add_current {
|
||||
echo Path "$1" not found >&2
|
||||
return
|
||||
}
|
||||
export PATH=$( echo ${p}:$PATH | awk -F: '{for (i=1;i<=NF;i++) { if ( !x[$i]++ ) printf("%s:",$i); }}' | sed 's,:\+$,,g' )
|
||||
export PATH="${p}:$PATH"
|
||||
path_remove_ducplicates
|
||||
echo PATH=$PATH
|
||||
}
|
||||
function path_remove_duplicates {
|
||||
# Remove duplicates in PATH
|
||||
PATH=$( echo $PATH | awk -F: '{for (i=1;i<=NF;i++) { if ( !x[$i]++ ) printf("%s:",$i); }}' | sed 's,:\+$,,g' )
|
||||
export PATH
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user