Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 18 lines (14 sloc) 495 Bytes
#!/bin/bash
# inspired from: https://mutelight.org/practical-tmux
if [[ -n "$TMUX" ]]; then
echo "where am i"
exit
fi
base_session=$(hostname | sed 's/\./_/g')
list_sessions=`tmux list-sessions 2>/dev/null | awk -F: '{print $1}'`
if [[ -z "$list_sessions" ]]; then
tmux new-session -d -s $base_session -n "$"
fi
new_session=${base_session}_`date +%m%d_%H%M`
tmux new-session -d -t $base_session -s $new_session
tmux attach-session -t $new_session \; set-option destroy-unattached