#!/bin/bash if [ `ps waux |grep "ssh $1" | grep -v screenssh | grep -v grep |wc -l` -gt 0 ] ; then echo -n "There is an existing session to $1, do you want to attempt to select it? " read YN case $YN in [yY] | [yY][Ee][Ss] ) echo "Selecting first $1" screen -X select $1 exit ;; * ) echo Starting new screen window. esac fi screen -X screen -t $1 ssh $1
Because I am a fiend with the tab button in terminals running Bash, I also want tab completion for 'screenssh' similar to 'ssh'. So my .bashrc has the following in it:
if [ -f /etc/bash_completion ]; then
source /etc/bash_completion
source /usr/share/bash-completion/completions/ssh
complete -F _ssh screenssh
fi
No comments:
Post a Comment