-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·33 lines (27 loc) · 869 Bytes
/
install.sh
File metadata and controls
executable file
·33 lines (27 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
#
# Adds the bin scripts for hnvm to your $PATH when you `source` it
#
# Usage:
# source install.sh
# node -v # Uses hnvm node script
set -e
source="${BASH_SOURCE[0]}"
while [ -h "$source" ]; do # resolve $source until the file is no longer a symlink
script_dir="$( cd -P "$( dirname "${source}" )" >/dev/null 2>&1 && pwd )"
source="$(readlink "${source}")"
[[ ${source} != /* ]] && source="${script_dir}/${source}"
done
script_dir="$( cd -P "$( dirname "${source}" )" >/dev/null 2>&1 && pwd )"
bin_path="${script_dir}/bin"
# Checks to see if we've already added the bin path to $PATH
not_in_path() {
[[ ":${PATH}:" != *":${bin_path}:"* ]]
}
if not_in_path; then
export PATH="${bin_path}:${PATH}"
# shellcheck source=/dev/null
source "${script_dir}/lib/hnvm/colors.sh"
green "Added local hnvm to PATH:"
echo "${PATH}"
fi