Skip to content

Instantly share code, notes, and snippets.

@o11c
Created May 1, 2017 04:22
Show Gist options
  • Save o11c/f80f3a759f55e8c04cb8eca0981a02a2 to your computer and use it in GitHub Desktop.
Save o11c/f80f3a759f55e8c04cb8eca0981a02a2 to your computer and use it in GitHub Desktop.
# This script is sourced from all over the place to fix broken shells.
# It does assume you have at *least* /usr/bin:/bin though.
# Significant care is taken to be sh-compatible; if bash or zsh could be
# required, it could be made simpler or more generic.
has_PATH () {
local tmp=":$PATH:"
[ "${tmp}" != "${tmp#*:$1:}" ]
}
prepend_PATH () {
has_PATH "$1" || PATH="$1:$PATH"
}
append_PATH () {
has_PATH "$1" || PATH="$PATH:$1"
}
prepend_PATH /usr/local/bin
prepend_PATH ~/.local/bin
prepend_PATH ~/bin
prepend_PATH /usr/lib/ccache
append_PATH /usr/local/games
append_PATH /usr/games
export PATH
# Known source'rs:
# ~/.profile
# ~/.zshrc
# ~/.xprofile
# ~/.xsessionrc
# ~/.bashrc
# ~/.config/plasma-workspace/env/path.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment