Hi Why do you need the session name? If you omit it from -t to any command then tmux try to detect the the current session itself.
Not that I don't believe there are reasons to want it, but I haven't come across any yet. You can always do something like: tmux ls|head -$(echo $TMUX|awk -F, '{print $3 + 1}')|tail -1|cut -d: -f1 But this will be just as unreliable as STY is. The session name and window name and a few other bits are not part of the standard options. The best way I can see would be to have a -s flag to display-message to display the message to stdout instead of a client status line, then you could do: tmux display -s "#S" And it would give you tmux's idea of the current session (which is normally accurate inside tmux so long as it can retrieve the slave pty name). On Thu, Nov 19, 2009 at 03:17:33AM +0100, Zrajm C Akfohg wrote: > Is there a way to get the current session name (in a script) in tmux? > > In screen I simply look at $STY (unless it has changed -- messy business > that). > > I've tried searching through the manpage, but only found how to > display session name in the status line. > > I had expected something like "tmux get-option session-name" or > somesuch. But maybe I'm just reading the manpage wrong? > > /zrajm > > P.S. I'm just *loving* the "update-environment" option. I have an > attach-wrapper-script for screen which does that (by storing selected > variables to a file and having all shells source that file when it's > updated), but built-in support is much appreciated! > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > tmux-users mailing list > tmux-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/tmux-users ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users