summaryrefslogtreecommitdiff
path: root/.local/bin/tmux-ssh
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2024-01-13 19:04:22 -0500
committerBenjamin Chausse <benjamin@chausse.xyz>2024-01-13 19:04:22 -0500
commit719c3734ff2d247b386e398b4cf98aa62c6f6cc0 (patch)
tree324522598ff677ee092e4e1047304dcc7d5f7567 /.local/bin/tmux-ssh
parentbf434758d9c60c323d571bc1e2e329edaad06fa3 (diff)
Cool new sshchoose prompt
Diffstat (limited to '.local/bin/tmux-ssh')
-rwxr-xr-x.local/bin/tmux-ssh17
1 files changed, 17 insertions, 0 deletions
diff --git a/.local/bin/tmux-ssh b/.local/bin/tmux-ssh
new file mode 100755
index 0000000..f47e0ac
--- /dev/null
+++ b/.local/bin/tmux-ssh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Usage: tmux-ssh <session-name> user@ip
+
+session="ssh-$1"
+
+tmux has-session -t $session 2>/dev/null
+
+if [ $? != 0 ]; then
+ # Set up your session
+ tmux new-session -d -s "$session" "ssh $2"
+ # R -q --no-save
+ # ([ -e /usr/bin/R ] && R -q --no-save) || python -q
+fi
+
+# Attach to created session
+tmux attach-session -t "$session"