From 627b2da3d018476eec991653bc721174fe46f2d9 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 8 May 2009 14:42:26 +0200 Subject: [PATCH] zsh: Fix attachment to running screen sessions. --- zsh/rc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zsh/rc b/zsh/rc index b82f75f..e17deed 100644 --- a/zsh/rc +++ b/zsh/rc @@ -418,12 +418,14 @@ alias vqs='vim -c "cd $(hg root)/.hg/patches/" "$(hg root)/.hg/patches/series"' # screen* is necessary as `screen` uses screen.linux for example for a linux # console which would otherwise cause an infinite loop. if [[ $TERM != screen* && $TERM != 'dumb' ]]; then + # Get running detached sessions. + session=$(screen -list | grep 'Detached' | awk '{ print $1; exit }') # Create a new session if none is running. - if [[ $(screen -list | grep "Detached" | wc -l) == 0 ]]; then + if [[ -z $session ]]; then screen # Reattach to a running session. else - screen -r + screen -r $session fi fi -- 2.45.2