home/bin/attachTmux.sh
2021-01-24 15:16:13 +01:00

15 lines
239 B
Bash
Executable file

#! /bin/bash
if [ -z "$1" ]; then
echo "Missing session name"
exit 1
fi
TMUXSESSION=$1
EXISTS=`tmux ls|grep "${TMUXSESSION}:"`
if [ -z "${EXISTS}" ]; then
tmux new -s ${TMUXSESSION}
else
tmux attach-session -t ${TMUXSESSION}
fi