git://git.iain.cx/iain
/
profile.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fugitive plugin.
[profile.git]
/
opt
/
bin
/
sshcolourterm
diff --git
a/opt/bin/sshcolourterm
b/opt/bin/sshcolourterm
index
0cf4b9f
..
82ecf58
100755
(executable)
--- a/
opt/bin/sshcolourterm
+++ b/
opt/bin/sshcolourterm
@@
-2,6
+2,15
@@
SSHCOLOURS=~/.ssh/colours
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=
fqdn=${1##*@}
colour=
@@
-18,7
+27,7
@@
fi
# Get colour by netgroup.
if [ -z "$colour" ]; then
for netgroup in $(ls "$SSHCOLOURS" | grep ^\@); do
# 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
colour=$(readlink "$SSHCOLOURS/$netgroup")
break
fi
@@
-28,8
+37,8
@@
fi
if [ ! -z "$colour" ]; then
colour=${colour##*/}
colour=${colour##*:}
if [ ! -z "$colour" ]; then
colour=${colour##*/}
colour=${colour##*:}
- echo -e "\033]49;$colour\007"
- clear
fi
fi
-exec ${SSHTERM_SSH:-ssh} ${1+"$@"}
+[ -n "$colour" ] && colour="-bg $colour -bd $colour"
+exec ${SSHTERM:-xterm} ${SSHTERM_TITLE:--title} "$title" \
+ $colour ${SSHTERM_EXEC:--e} ${SSHTERM_SSH:-ssh} ${1+"$@"}