Merge pull request #493 from ipoval/fix_duplicate_entries_in_path
Fix duplicate entries in path, closes #482 and closes #483pull/495/head
commit
603c71736e
|
|
@ -361,3 +361,21 @@ all_groups ()
|
||||||
cat $file | sort | uniq
|
cat $file | sort | uniq
|
||||||
rm $file
|
rm $file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! type pathmunge > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
function pathmunge () {
|
||||||
|
_about 'prevent duplicate directories in you PATH variable'
|
||||||
|
_group 'lib helpers'
|
||||||
|
_example 'pathmunge /path/to/dir is equivalent to PATH=/path/to/dir:$PATH'
|
||||||
|
_example 'pathmunge /path/to/dir after is equivalent to PATH=$PATH:/path/to/dir'
|
||||||
|
|
||||||
|
if ! [[ $PATH =~ (^|:)$1($|:) ]] ; then
|
||||||
|
if [ "$2" = "after" ] ; then
|
||||||
|
export PATH=$PATH:$1
|
||||||
|
else
|
||||||
|
export PATH=$1:$PATH
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'manage your nginx service'
|
about-plugin 'manage your nginx service'
|
||||||
|
|
||||||
# Set the path nginx
|
|
||||||
export NGINX_PATH='/opt/nginx'
|
export NGINX_PATH='/opt/nginx'
|
||||||
|
pathmunge $NGINX_PATH/sbin after
|
||||||
# Add nginx to the path
|
|
||||||
export PATH=$PATH:$NGINX_PATH/sbin
|
|
||||||
|
|
||||||
function nginx_reload() {
|
function nginx_reload() {
|
||||||
about 'reload your nginx config'
|
about 'reload your nginx config'
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'Node.js helper functions'
|
about-plugin 'Node.js helper functions'
|
||||||
|
|
||||||
export PATH=./node_modules/.bin:$PATH
|
pathmunge ./node_modules/.bin
|
||||||
|
|
||||||
# Make sure the global npm prefix is on the path
|
# Make sure the global npm prefix is on the path
|
||||||
[[ `which npm` ]] && export PATH=$(npm config get prefix)/bin:$PATH
|
[[ `which npm` ]] && pathmunge $(npm config get prefix)/bin
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue