diff options
author | Patrick Spek <p.spek@tyil.nl> | 2021-10-14 11:10:25 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2021-11-10 11:00:25 +0100 |
commit | 4d30d355993646dcf9a87b5c0b7c4ca1874978d5 (patch) | |
tree | a050f46af677ef05bf96e31b60593488353a1209 | |
parent | 2c2896ed5d22b899b6df7b301dccca039033c7ab (diff) |
Update ta script
-rwxr-xr-x | .local/bin/ta | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/.local/bin/ta b/.local/bin/ta index 3d364fa..200aeec 100755 --- a/.local/bin/ta +++ b/.local/bin/ta @@ -1,13 +1,16 @@ -#!/usr/bin/env sh +#!/bin/sh -t="tmux -2 -f ${HOME}/.config/tmux/conf -u" +tmux="tmux -2 -f ${HOME}/.config/tmux/conf -u" +session="$(hostname -s)" -if [ -z "$1" ] +if [ "$1" ] then - session=$(hostname -s) -else - session=$(hostname -s)/$1 + session="$session/$1" fi -${t} attach -t "${session}" || ${t} new-session -s "${session}" +if tmux has-session -t "$session" 2>/dev/null +then + exec $tmux attach -t "$session" +fi +exec $tmux new-session -s "$session" |