#!/usr/bin/env bash # ~/.bashrc: executed by bash(1) for non-login shells. # If not running interactively, don't do anything case $- in *i*) ;; *) return ;; esac chmod 700 ~/.bashrc.d chmod 600 ~/.bashrc ~/.bashrc.d/* # check if we are already in a Tmux session or open/attach the default one if [[ "${TERM-}" != tmux* ]] && [[ -z "${TMUX}" ]] && [[ -z "${SSH_CONNECTION}" ]] && command -v tmux 1> /dev/null; then # open/attach the local default Tmux session systemd-run -q --scope --user tmux new-session -A -s local && exit elif [[ -z "${TMUX}" ]] && [[ -n "${SSH_CONNECTION}" ]] && command -v tmux 1> /dev/null; then # open/attach the SSH default Tmux session systemd-run -q --scope --user tmux new-session -A -s ssh && exit fi # if Tmux is not installed or if we are inside a Tmux session continue the sourcing for file in ~/.bashrc.d/*.bashrc; do source "${file}" done