about summary refs log tree commit diff
path: root/profile/.profile.d/30_path.sh
blob: 1469162b0fc4aa987237de8c9f9391148cca79b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

export PATH="/sbin:/bin:/usr/sbin:/usr/bin"

path_prepend() {
	[ ! -d "${1}" ] && return
	echo "${PATH}" | grep -q "\(:\|^\)${1}\(:\|$\)" && return
	export PATH="${1}:${PATH}"
}

path_append() {
	[ ! -d "${1}" ] && return
	echo "${PATH}" | grep -q "\(:\|^\)${1}\(:\|$\)" && return
	export PATH="${PATH}:${1}"
}

path_append "/usr/local/bin"
path_append "${HOME}/.bin"
path_append "${HOME}/.local/bin"

Consider giving Nix/NixOS a try! <3