On Thu, Mar 26, 2015 at 7:31 AM, Robert LeBlanc <rob...@leblancnet.us> wrote:
>
>
> On Thu, Mar 26, 2015 at 12:13 AM, Benoit Pierre <benoit.pie...@gmail.com>
> wrote:
>>
>> On Thu, Mar 26, 2015 at 6:53 AM, Robert LeBlanc <rob...@leblancnet.us>
>> wrote:
>> > I'm trying to make my .tmux.conf work for both 1.8 and 1.9 while
>> > depreciating the old syntax. I can't get 1.9 (from Debian) or 1.9a
>> > (compiled
>> > from source) to work properly. I open a new tmux session and run:
>> >
>> > if-shell "[[ `/usr/bin/tmux -V` = *1.9* ]]" "display-message 'Yes'"
>> > "display-message 'No'"
>> >
>> > I always get "No". If I open up tmux on CentOS7 with 1.8 and adjust the
>> > line
>> > to test for 1.8, I get "Yes" as expected. I get "No" if I change it to
>> > 1.9.
>> > So it is working just fine in 1.8.
>>
>> Are you sure it's not due to different shells and the use of "[[ ]]"
>> instead of "[ ]" ?
>>
>> > dash -c '[[ "`tmux -V`" = *2.0* ]]'; echo $?
>> dash: 1: [[: not found
>> 127
>> > bash -c '[[ "`tmux -V`" = *2.0* ]]'; echo $?
>> 0
>>
>> Also, note the additional double quotes for the call to `tmux -V`.
>>
>> Cheers,
>>
>
> My shell is bash, but I'm not sure if tmux executes in my shell or it's own.
> I can't get dash to pass, and I don't see a need for the extra double quotes
> in bash.

Weird, I need those with my version of bash.

>
> rdleblanc@rdleblanc-laptop:/tmp$ tmux -V
> tmux 1.9
> rdleblanc@rdleblanc-laptop:/tmp$ dash -c '[ "`tmux -V`" = *1.9* ]'; echo $?
> 1
> rdleblanc@rdleblanc-laptop:/tmp$ bash -c '[[ "`tmux -V`" = *1.9* ]]'; echo
> $?
> 0
> rdleblanc@rdleblanc-laptop:/tmp$ bash -c '[[ `tmux -V` = *1.9* ]]'; echo $?
> 0
>
> I'm really at a loss. The CentOS box doesn't have dash, so if tmux is
> specifically using that, then I can see it as being the problem, but I would
> expect that it would us my shell.

The problem is neither "[[" or the use of '*' in the test is valid
bourne shell syntax, so it's really not portable, and after looking at
it with strace, it appears tmux is using /bin/sh (while my shell is
/bin/zsh).

I don't know for Debian, but on Ubuntu /bin/sh is linked to dash, and
to bash on Redhat.

>
> Thanks,
> Robert LeBlanc
>

-- 
A: Because it destroys the flow of conversation.
Q: Why is top posting dumb?

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to