From 0a201e65bf3edbc2bc83529ddc5dda6ea490f4fd Mon Sep 17 00:00:00 2001 From: Timothy Sanders Date: Tue, 2 Nov 2021 01:19:40 -0400 Subject: [PATCH] Fix for mosh and some other non-interactive shells If certain programs are installed that are not part of the base system, such as what is installed via homebrew, then they will not be found in a non-interactive shell. Rsync and git will default to the system provided versions in /usr/bin, and programs like mosh-server and git-annex will not work at all. More discussion here: https://github.com/mobile-shell/mosh/issues/102#issuecomment-12503646 --- .bashrc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 12570026634..b204d77b9a3 100644 --- a/.bashrc +++ b/.bashrc @@ -1 +1,10 @@ -[ -n "$PS1" ] && source ~/.bash_profile; +# Only source ~/.bash_profile if interactive shell +# Provide some extra PATH locations for things using a non-interactive shell +# such as git-annex, mosh, and rsync via homebrew. + +if [[ -n "$PS1" ]] ; then + source ~/.bash_profile +elif + PATH=$HOME/bin:/usr/local/bin:/opt/homebrew/bin:$PATH + return +fi