Skip to content

Instantly share code, notes, and snippets.

@jamesog
Created June 4, 2012 15:05
Show Gist options
  • Save jamesog/2868925 to your computer and use it in GitHub Desktop.
Save jamesog/2868925 to your computer and use it in GitHub Desktop.
if tmux has 2>/dev/null; then
echo "tmux sessions found:"
tmux ls
echo
echo -n "Attaching to default tmux session in 5 seconds. Press Ctrl-C to abort"
for ((i=5; i>0; i--))
do
printf "."
if read -s -t 1 -k ; then break; fi
done
tmux attach
else
echo -n "Starting new tmux session in 3 seconds (Ctrl-C to abort)."
sleep 3
tmux new
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment