From d50534572d71195b78f5033c9e589a267c5dc0e5 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Tue, 13 Feb 2024 10:04:08 +0100 Subject: [PATCH] Prevent bash to source-bashrc-because-ssh when obviously non-interactive See: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html The bash "cleverness" applies even to deply nested `bash -c`, e.g direnv. --- bash/rc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bash/rc b/bash/rc index dbfe45e..bc831fa 100644 --- a/bash/rc +++ b/bash/rc @@ -1,5 +1,9 @@ ## bashrc, called for interactive shells +if [[ $- != *i* ]]; then + return +fi + [[ -z "$DOTFILES_ROOT_DIR" ]] && source "$HOME/.dotfilesrc" source $DOTFILES_SHELL_DIR/aliases