diff --git a/.bash_extra b/.bash_extra index ade3b19..f546624 100644 --- a/.bash_extra +++ b/.bash_extra @@ -12,12 +12,15 @@ source "${HOME}/dotfiles/.bash_ps1" # add my scripts to PATH PATH=$PATH:"${HOME}/dotfiles/scripts" -### tmux auto attach -# Check if the user ID is not 0 (root) -if [ "$EUID" -ne 0 ]; then - # then auto attach - if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then - tmux attach -t default || tmux new -s default +## check interactive shell https://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch +if [[ $- == *i* ]] ; then + ### tmux auto attach + # Check if the user ID is not 0 (root) + if [ "$EUID" -ne 0 ]; then + # then auto attach + if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then + tmux attach -t default || tmux new -s default + fi fi fi