summaryrefslogtreecommitdiff
path: root/.local/bin/tmux-ssh
blob: f47e0acf83b034170713960d8e6f7021999ff1bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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"