aboutsummaryrefslogtreecommitdiff
path: root/bashrc
blob: 722bbd533d33475c052d9fe9b219a0088e8e2793 (plain)
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
# If not running interactively, don't do anything
[[ $- != *i* ]] && return

pathadd() {
	if [ -d "$1" ] && [[ "$PATH" != *"$1"* ]]; then
		PATH="$1":$PATH
	fi
}

pathadd /bin
pathadd /sbin
pathadd ${HOME}/.local/bin

if [[ -z "$DOTFILES_LOCATION" ]]
then
	DOTFILES_LOCATION=$(dirname $(readlink -f $HOME/.bashrc))
	export DOTFILES_LOCATION
fi

pathadd ${DOTFILES_LOCATION}/bin

source $DOTFILES_LOCATION/aliases

# navigate to first parent directory matching a regex
upto() {
	if [ -z "$1" ]; then
		return
	fi

	local upto=$1
	cd "${PWD/\/$upto\/*//$upto}"
}