Introduce function for uniq PATH
This commit is contained in:
3
bashrc
3
bashrc
@@ -15,5 +15,4 @@ for rc_file in $WORKSPACE/rc/*.sh; do
|
||||
done
|
||||
|
||||
append_path "$LWS/bin"
|
||||
PATH="$(uniq_path)"
|
||||
|
||||
set_uniq_path
|
||||
|
||||
@@ -35,7 +35,16 @@ function uniq_path() {
|
||||
echo "$PATH" | tr ":" "\n" | awk '!seen[$0]++' | tr "\n" ":" | sed -r 's/:+/:/g' | sed -r 's/^:|:$//g'
|
||||
}
|
||||
|
||||
function set_uniq_path() {
|
||||
PATH="$(uniq_path)"
|
||||
}
|
||||
|
||||
function is_alias() {
|
||||
alias "$1" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
function can_run() {
|
||||
local application="$1"
|
||||
command -v "$application" > /dev/null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user