bashrc/.bashrc.d/99-autostart.bashrc
2023-03-18 18:49:08 +07:00

21 lines
641 B
Bash

#!/usr/bin/env bash
# ~/.bashrc: executed by bash(1) for non-login shells.
# ==============================
# AUTOSTART
# ==============================
# run tmux if TMUX variable is null
if [[ "${TERM-}" != tmux* ]] && [[ -z "${TMUX}" ]] && [[ -z "${SSH_CONNECTION}" ]]; then
tmuxa
elif [[ -z "${TMUX}" ]] && [[ -n "${SSH_CONNECTION}" ]]; then
tmuxs
fi
# run MOTD at login only in an ssh session
if [[ -n "${TMUX}" ]] && [[ -n "${SSH_CONNECTION}" ]] && [[ "${SSH_MOTD-}" == 1 ]] && [[ -f "/etc/update-motd.d/00-motdfetch" ]]; then
motd
else
# use function pgdown to get the prompt to terminal window bottom
pgdown
fi