I have this script - what it does is list all the tmux sessions present on a host. The it presents them in a way that i cah cut and paste the command on to the command line.
Code:
#!/usr/bin/perl -w
open FILE, "/usr/bin/tmux list-sessions|";
while (<FILE>) {
$line = $_;
if ($line =~ /(\w+):*?/) {
print "tmux attach-session -t $1\n";
}script
}
What i need is - i need the tmux sessions listed in a numbered fashion as an output to the script - something that will say 'press 1 for this session' , press 2 for that session' , 'press 3 for the third session'
sort of like the case statement in bash - except dynamic - interactive.
can anybody point me to soemthing - a tutorial. I dont even know where to start.
can anyone point me to an example.