On Sun, Sep 12, 2010 at 06:33:05PM -0500, Joshua Isom wrote:
> On 9/12/2010 5:07 PM, Nicholas Marriott wrote:
> >On Sun, Sep 12, 2010 at 02:58:01PM -0500, Joshua Isom wrote:
> >># 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.
No, I meant that 1>&2 2>/dev/null looks unusual, did you really still
want stdout (although has-session doesn't output anything to stdout, so
it hardly matters much)?