X-Git-Url: http://git.iain.cx/?p=profile.git;a=blobdiff_plain;f=opt%2Fbin%2Fsshcolourterm;h=e143a758f29380fa0b368bf41101593d5f428940;hp=0cf4b9fe0e92474d00ba9ab70c1bb6dfe95f1ec9;hb=402aaf0823df191615b6027ae8289aa7bb78e919;hpb=19a30cda6029906dbfadf0ea0e284b518947e429 diff --git a/opt/bin/sshcolourterm b/opt/bin/sshcolourterm index 0cf4b9f..e143a75 100755 --- a/opt/bin/sshcolourterm +++ b/opt/bin/sshcolourterm @@ -2,6 +2,15 @@ SSHCOLOURS=~/.ssh/colours +while getopts ":t:" opt; do + case "$opt" in + t) title="$OPTARG";; + esac +done +shift $((OPTIND-1)) + +[ -z "$title" ] && title="$1" + fqdn=${1##*@} colour= @@ -18,7 +27,7 @@ fi # Get colour by netgroup. if [ -z "$colour" ]; then for netgroup in $(ls "$SSHCOLOURS" | grep ^\@); do - if netgroups $netgroup ${fqdn%%.*} 2>/dev/null; then + if netgroups $netgroup ${fqdn%%.*} &>/dev/null; then colour=$(readlink "$SSHCOLOURS/$netgroup") break fi @@ -28,8 +37,8 @@ fi if [ ! -z "$colour" ]; then colour=${colour##*/} colour=${colour##*:} - echo -e "\033]49;$colour\007" - clear fi -exec ${SSHTERM_SSH:-ssh} ${1+"$@"} +[ -n "$colour" ] && colour="-bg $colour" +exec ${SSHTERM:-xterm} ${SSHTERM_TITLE:--title} "$title" \ + $colour ${SSHTERM_EXEC:--e} ${SSHTERM_SSH:-ssh} ${1+"$@"}