Problem with status line from script

14 views
Skip to first unread message

Cecil Westerhof

unread,
Oct 20, 2020, 9:56:42 AM10/20/20
to tmux-...@googlegroups.com
I like to get a little bit of useful information in my statusline. So I have the following script:
    msg="$(date +%F)$(uptime)"
    # msg=${msg/ load average:/}
    echo ${msg}

In tmux.conf I have:
    set -g status-right         '#(infoStatusline)'
    set -g status-right-length  80

The above script works with the second line commented out. But when I remove the comment it does not work anymore. The script gives the output I want when called from the command line, but the tmux status line becomes blank.

What is happening here and how do I solve it?

--
Cecil Westerhof

Nicholas Marriott

unread,
Oct 20, 2020, 9:59:23 AM10/20/20
to Cecil Westerhof, tmux-users
${//} is a bash feature so you will need to run your script with bash, #() will use /bin/sh by default. Change it to #(bash /path/to/script).

--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/CAG-LmmDMBRCpxTMveBPg28JpGXvJfg1hQzqA4tVtBbMuo07TiQ%40mail.gmail.com.

Cecil Westerhof

unread,
Oct 20, 2020, 10:08:25 AM10/20/20
to tmux-...@googlegroups.com
That was fast. :-D

Op di 20 okt. 2020 om 15:59 schreef Nicholas Marriott <nicholas...@gmail.com>:
${//} is a bash feature so you will need to run your script with bash, #() will use /bin/sh by default. Change it to #(bash /path/to/script).

I start the script with:
    #!/usr/bin/env bash

That works also and I find that a better solution.

Thanks.


Is it possible to let #() use bash by default?

On Tue, 20 Oct 2020 at 14:56, Cecil Westerhof <cldwes...@gmail.com> wrote:
I like to get a little bit of useful information in my statusline. So I have the following script:
    msg="$(date +%F)$(uptime)"
    # msg=${msg/ load average:/}
    echo ${msg}

In tmux.conf I have:
    set -g status-right         '#(infoStatusline)'
    set -g status-right-length  80

The above script works with the second line commented out. But when I remove the comment it does not work anymore. The script gives the output I want when called from the command line, but the tmux status line becomes blank.

What is happening here and how do I solve it?

--
Cecil Westerhof
Reply all
Reply to author
Forward
0 new messages