On 9/12/2010 5:07 PM, Nicholas Marriott wrote:
> On Sun, Sep 12, 2010 at 02:58:01PM -0500, Joshua Isom wrote:

>> sessions=
>> # Check to see if tmux is running, or else sed might stall
>> tmux has-session 1>&2 2>/dev/null
>
> Are you sure this pair of redirections does what you think it does? :-)
>
> You know that if tmux is running you can use choose-session command to
> select a session?
>
> Something like:
>
> (tmux attach\; choose-session) || tmux new
>
> Will attach and let you choose if there are existing sessions, or create
> a new one if not. Although I realise yours does a little more.
>
>

If tmux isn't running, tmux will print out an error and set the error 
code.  If I just use the list-sessions line, sed can hang waiting for 
input.  That line is just to check to see if tmux is running before 
risking a hang.  There didn't seem to be a better option in the man page.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to