Skip to content

Commit

Permalink
Merge pull request #2 from terencehonles/patch-1
Browse files Browse the repository at this point in the history
fixed the TODO about showing the full IPv4 address instead of just the first octet
  • Loading branch information
adnichols committed Apr 17, 2012
2 parents d6a97c5 + 7bb5d4e commit ed1bbb0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions 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 ed1bbb0

Please sign in to comment.