summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2013-07-04 11:11:07 -0700
committerJesse Morgan <jesse@jesterpm.net>2013-07-04 11:11:07 -0700
commit98a2554ee29415a5cf7965114975b875d0d3f74a (patch)
tree1097d63935c69556cd5ff06080592bf7c0b9739e
parenteb80ea41be3dc36ec99d3506c6da3efa47dc9fe2 (diff)
Creating sshclip.
sshclip is a script which opens a ssh session to the hostname in the clipboard in your favorite terminal.
-rwxr-xr-xsshclip17
1 files changed, 17 insertions, 0 deletions
diff --git a/sshclip b/sshclip
new file mode 100755
index 0000000..4a4de8d
--- /dev/null
+++ b/sshclip
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Open a SSH session to the hostname in the clipboard
+# Requires the xclip package to be installed.
+
+HOSTNAME=$(xclip -out|cut -d' ' -f1)
+
+if [ -z "$HOSTNAME" ]; then
+ HOSTNAME=$(xclip -out -selection secondary|cut -d' ' -f1)
+fi
+
+if [ -n "$HOSTNAME" ]; then
+ i3-sensible-terminal -e ssh $HOSTNAME &
+else
+ notify-send "No hostname in clipboard"
+ exit 1
+fi