Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed the "TODO" about showing the full IPv4 address instead of just …

…the first octet
  • Loading branch information...
commit 7bb5d4ef4ac5dfb05b23db530d66c6294d03bdfa 1 parent d6a97c5
@terencehonles terencehonles authored
Showing with 3 additions and 4 deletions.
  1. +3 −4 bin/sc
View
7 bin/sc
@@ -1,13 +1,12 @@
-#!/bin/sh
+#!/bin/bash
# Wrapper to start tmux sessions for connections to hosts
# This is a security test I like to perform - we want to show what
# ssh binary is being used to prevent any trickery
WHICH_SSH=`which ssh`
-# Show only the start of the hostname.
-# TODO: Make this work better with IP addresses (only shows first octet)
-HOST=`echo $1|cut -d. -f1`
+# Show only the IPv4 address or the start of the hostname.
+HOST=`grep -o '^\([0-9]\+\.\)\{3\}[0-9]\+\|^[^.]\+' <<<"${1}"`
# Start tmux window
tmux new-window -n ${HOST} "echo 'Using: $WHICH_SSH' ; ~/bin/sc-ssh ${1}"

0 comments on commit 7bb5d4e

Please sign in to comment.
Something went wrong with that request. Please try again.