Diff: SshAlwaysScreen

Differences between version 2 and previous revision of SshAlwaysScreen.

Other diffs: Previous Major Revision, Previous Author

Newer page: version 2 Last edited on April 20, 2016 4:16 pm by PhilHollenback Revert
Older page: version 1 Last edited on April 20, 2016 4:14 pm by PhilHollenback Revert
@@ -22,4 +22,8 @@
  /usr/bin/ssh $@ 
  fi 
 
 </pre> 
+  
+-----  
+CategoryGeekStuff\\  
+CategoryLinuxStuff  

version 2

# always use screen on remote hosts if possible
ssh ()
{
    if [ x$1 = x ]
    then
        # ssh doesn't make sense without arguments
        echo "must supply hostname" >%2
    elif [ x"$2" = "x" ]
    then
        # only hostname specified, try to ssh and launch screen
        if ! /usr/bin/ssh -t $1 screen -A -D -RR
        then
            # if attempt to launch screen failed, fall back to regular
            # ssh
            /usr/bin/ssh $@
        fi
    else
        # if user passes more than one arg, it's something to execute
        # on remote host, and thus we don't want to launch remote
        # screen.
        /usr/bin/ssh $@
    fi
}

CategoryGeekStuff
CategoryLinuxStuff



Our Founder
ToolboxClick to hide/show