2 # Filename: attach-screen
3 # Purpose: multi-attach to GNU screen session, creating a new one if necessary
4 # Authors: (c) Phil Gregory <phil_g@pobox.com>, (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: Taken from http://aperiodic.net/phil/configs/bin/attach-screen
7 ################################################################################
9 # -U option basically means "terminal does not have UTF-8 support"
10 if [ x$1 = "x-U" ]; then
14 # Bring in my ssh-agent, so screen will have it available in all windows.
15 if [ -x /usr/bin/keychain ] ; then
16 keychain --nocolor --quiet ~/.ssh/id_rsa
17 . ~/.keychain/`hostname`-sh
20 # Not a standard environment variable, but I need it for host-dependent
21 # decisions in .screenrc.
22 export HOST=`hostname`
24 # multi-attach to main session, creating it if necessary. exec to save a
26 [ -r /etc/grml/screenrc ] && SCREENRC='-c /etc/grml/screenrc'
27 exec screen -S main -xRR $SCREENRC
29 ## END OF FILE #################################################################