aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-20 18:40:49 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-20 18:40:49 +1200
commit0ce8aa86a593c19329c96d865a58db89053b130b (patch)
treea07b28e2b610e232826cbd2c100ec0fd4574699b
parentExit sshi(1) with 1 not 2 if null SSH_CONNECTION (diff)
downloaddotfiles-0ce8aa86a593c19329c96d865a58db89053b130b.tar.gz
dotfiles-0ce8aa86a593c19329c96d865a58db89053b130b.zip
Strip trailing period from sshi(1) hostnames
-rwxr-xr-xbin/sshi4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/sshi b/bin/sshi
index a41363ba..bf710b8a 100755
--- a/bin/sshi
+++ b/bin/sshi
@@ -17,8 +17,8 @@ printf '%s\n' "$SSH_CONNECTION" "${SSH_TTY:-unknown}" | (
read -r tty
# Try to resolve the client and server IPs
- ch=$(dig -x "$ci" +short 2>/dev/null | sed 1q)
- sh=$(dig -x "$si" +short 2>/dev/null | sed 1q)
+ ch=$(dig -x "$ci" +short 2>/dev/null | sed 's/\.$//;1q')
+ sh=$(dig -x "$si" +short 2>/dev/null | sed 's/\.$//;1q')
# Print the results in a human-readable format
printf "%s:%u -> %s:%u (%s)\n" \