Skip to content

Instantly share code, notes, and snippets.

@wx13
Last active December 26, 2015 19:19
Show Gist options
  • Save wx13/7200432 to your computer and use it in GitHub Desktop.
Save wx13/7200432 to your computer and use it in GitHub Desktop.
Easy selection of available tmux sessions
#!/bin/bash
LD_LIBRARY_PATH=$HOME/local/lib
k=0
choices=()
while read line
do
k=$((k+1))
echo $k "$line"
choices[$k]=${line%%:*}
done < <(tmux list-sessions)
echo -n "choice: "
read ans
tmux attach-session -t ${choices[$ans]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment