Bash: prompt for tmux to show MOTD in SSH sessions

This commit is contained in:
DuckDuckWhale 2021-12-27 01:26:25 -08:00
parent 396624c6d5
commit 2ef53d351a
Signed by: DuckDuckWhale
GPG Key ID: E4B9FC170FFD71CE

View File

@ -29,6 +29,15 @@ popd() {
cd .
}
if [ -z "$TMUX" ] && [ "$PWD" == ~ ]; then
if [ -z "$TMUX" ] && [ -n "$SSH_TTY" ]; then
tput sc
tput smso
echo -n 'tmux: space - shell: any key'
tput sgr0
read -rsN1 input
tput rc
tput el
if [ "$input" = ' ' ]; then
tmux new -As default
fi
fi