[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reattaching to a detached screen
From: |
Aaron Davies |
Subject: |
Re: Reattaching to a detached screen |
Date: |
Fri, 2 Jan 2009 10:38:30 +0800 |
On Fri, Jan 2, 2009 at 6:08 AM, Michael Grant <address@hidden> wrote:
> Here is what I use in my .bash_login:
>
> if screen -wipe 2>&1 | egrep -v "No Sockets found" >/dev/null; then
> echo -n "Reattach to detached tree? (y/n) [space=y] "
> read -n1 a;
> if [[ ("$a" = "y") || ("$a" = "") ]]; then
> exec screen -xRR
> fi
> echo ""
> else
> echo "type 'screen' to start screen"
> fi
due to additional requirements, i have this:
if [[ "$TERM" != vt320 ]]; then
if ! which screen|grep "no screen"; then
if screen -ls|head -n3|tail -n2|cut -f2|cut -d. -f2-|grep -q
'^'main'$'; then
exec screen -r main
else
exec screen -S main
fi
fi
fi
the extra "if" is due to my generally having at least one detached
"daemon" screen hanging around. (the TERM test filters out my
blackberry's ssh app. i have enough trouble using it without dealing
with ^A :)
a named version of -D -RR (attach to named screen (power-detaching
others if necessary) if exists, create if not) would be a welcome
alternative: "screen -D -RR main"
--
Aaron Davies
address@hidden