[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question regarding the detection of ssh connections with screen

From: Gerhard Siegesmund
Subject: Re: question regarding the detection of ssh connections with screen
Date: Sat, 5 Nov 2005 23:11:06 +0100
User-agent: Mutt/1.5.11

Hello Martin

> As i am someone who's regularily working remotely on several machines,
> connecting from a local screen session via ssh to those remote
> maschines. Not all of those offer me the possibilty to run another
> screen there. It'd be really helpful for me i could put an
> identification into the local screens hardstatus line which would
> allow me to recognize that i'm being working on another machine right
> now and even better to let me know hostname and maybe even username.

I am using the following small script to open new ssh-connections in a
new window with a given title. Maybe this is a starting point:


# If running in screen open new window with ssh in it
if [ -n "$STY" ]; then
        # get the server name
        if (echo $command | grep -q '@'); then
                title=$(echo $command | /bin/sed -e 
's/address@hidden([a-zA-Z0-9._-]\{1,10\}\).*/\1/g' -e 's/ .*$//')
                # no server found. so start in local window
                exec /usr/bin/ssh $*
        /usr/bin/screen -t "$title" /usr/bin/ssh $*
        # else just start ssh in local window
        exec /usr/bin/ssh $*

For extra handyness i created an alias in my bashrc

alias ssh=$HOME/bin/

If you want to run a normal ssh-session (or have to) just use the full
path to ssh to avoid the alias.

Hope this helps.

  --== Jerri ==--
Homepage:   ICQ: 54160208
Public PGP Key:

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]