about summary refs log tree commit diff stats
path: root/profile/path.sh
diff options
context:
space:
mode:
Diffstat (limited to 'profile/path.sh')
-rw-r--r--profile/path.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/profile/path.sh b/profile/path.sh new file mode 100644 index 0000000..56bdc39 --- /dev/null +++ b/profile/path.sh
@@ -0,0 +1,30 @@
1# PATH
2
3# add a path to PATH, but only if it's not already there
4path_add() { # path_add [-a] PATH...
5 # -a appends (default is prepend)
6 APPEND=false
7 if [ "x$1" = "x-a" ]; then
8 APPEND=true
9 shift
10 fi
11
12 for p; do
13 case ":$PATH:" in
14 *:"$p":*) ;;
15 *)
16 if $APPEND; then
17 PATH="$PATH:$p"
18 else
19 PATH="$p:$PATH"
20 fi
21 ;;
22 esac
23 done
24
25 unset APPEND
26}
27
28path_add "$HOME/bin" "$HOME/usr/bin"
29
30command -v luarocks >/dev/null 2>&1 && path_add "$HOME/.luarocks/bin"