From 0bc370861e55a46709f4d6ac6460c0b98bfbccac Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Tue, 10 Jun 2025 10:47:17 +0200 Subject: [PATCH] exec into screen immediately Doing otherwise is a waste of time: - shell configuration won't be used anyway - ssh-agent is left hanging around forever --- .zshrc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.zshrc b/.zshrc index 9a7d209..7165c5f 100644 --- a/.zshrc +++ b/.zshrc @@ -1,5 +1,17 @@ # Interactive shell. +# Login shell, connected via SSH, interactive (implied by running in this file), +# not in a GNU screen session already and screen is installed: jump to an active +# screen session or start a new, UTF-8 capable. +# +# Since we exec right afterwards, there's no point in setting this shell up. +case "$0" in -*) + [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && \ + [ -z "$STY" ] && \ + which screen 2>/dev/null && \ + exec screen -URR +esac + HISTFILE=~/.zsh_history HISTSIZE=10000 SAVEHIST=10000 @@ -100,13 +112,3 @@ PROMPT='%(?..%F{red}%?%f )[%n@%m] %3~${vcs_info_msg_0_} %# ' # export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME?}" # export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL?}" [ -r ~/.zshrc_local ] && source ~/.zshrc_local || true - -# Login shell, connected via SSH, interactive (implied by running in this file), -# not in a GNU screen session already and screen is installed: jump to an active -# screen session or start a new, UTF-8 capable. -case "$0" in -*) - [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && \ - [ -z "$STY" ] && \ - which screen 2>/dev/null && \ - exec screen -URR -esac