From c141e51b662deb81062493c0c9075daae3b15a0c Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sun, 3 Jan 2021 22:19:52 +0100 Subject: [PATCH] bash: check for brew after PATH manipulation --- files/bashrc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/files/bashrc b/files/bashrc index ea682a5..0e46c31 100644 --- a/files/bashrc +++ b/files/bashrc @@ -23,11 +23,6 @@ export LESSHISTFILE="$XDG_DATA_HOME/less/history" export LESSHISTSIZE=1000 export LOCAL_CONFIG="$HOME/.local/etc" export LOCAL_PREFIX="/usr/local" -if command -v brew &>/dev/null; then - LOCAL_PREFIX="$(brew --prefix)" - export HOMEBREW_NO_ANALYTICS=1 - export HOMEBREW_NO_AUTO_UPDATE=1 -fi MANPATH="$(unset MANPATH; manpath)" export MANPATH export PAGER=less @@ -35,17 +30,13 @@ export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py" # shellcheck disable=SC2016 # This expression is to be interpreted by vim, not bash. export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC' -############################################################################## -# Customize PATH (and MANPATH) -############################################################################## - # Prevent path_helper from messing with the PATH when starting tmux. # See: https://superuser.com/a/583502 # shellcheck disable=SC2123 # PATH is being intentionally manipulated here. # shellcheck disable=SC1091 # /etc/profile is provided by macOS. [ "$(uname)" == "Darwin" ] && { PATH=""; source /etc/profile; } -_prepend_path() { # 1: dir to add, 2: path variable to manipulate +_prepend_path() { # prepend $1 to variable $2 using : as separator if [ -d "$1" ] && [ -n "$2" ]; then local _path="${!2}" # get path variable value case ":$_path:" in @@ -76,7 +67,14 @@ while read -r dir; do _prepend_path "$dir" MANPATH; done </dev/null 2>&1; then + LOCAL_PREFIX="$(brew --prefix)" + export HOMEBREW_NO_ANALYTICS=1 + export HOMEBREW_NO_AUTO_UPDATE=1 +fi stty -ixon # disable ctrl-s and ctrl-q command -v solarize >/dev/null && solarize