1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 19:30:01 +02:00
dotfiles/scripts/tmuxs/kill.sh

15 lines
431 B
Bash
Executable file

#!/usr/bin/env bash
BASE_PATH=$(dirname $(readlink -f $BASH_SOURCE))
source ${BASE_PATH}/helpers.sh
SESSION=$(echo $@ | get_session_name)
# If we are killing the current session. Move to another
if [ "$(current_session)" == "$SESSION" ]; then
NEXT=$(list_sessions | grep -v "${SESSION}" | head -n 1 | get_session_name)
if [ ! -z "$NEXT" ]; then
tmux switch -t "${NEXT}"
fi
fi
tmux kill-session -t "$SESSION"