From 2ef53d351abce25911a5de74b663036e7665820e Mon Sep 17 00:00:00 2001 From: DuckDuckWhale Date: Mon, 27 Dec 2021 01:26:25 -0800 Subject: [PATCH] Bash: prompt for tmux to show MOTD in SSH sessions --- bash/.bashrc.append | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bash/.bashrc.append b/bash/.bashrc.append index e8ff566..bd72c79 100644 --- a/bash/.bashrc.append +++ b/bash/.bashrc.append @@ -29,6 +29,15 @@ popd() { cd . } -if [ -z "$TMUX" ] && [ "$PWD" == ~ ]; then - tmux new -As default +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