16

I want my tmux session to show my current ip address in the right hand side of the status bar but I am having the hardest time figuring up the right syntax. The command works perfectly in the shell, but tmux won't parse it.

set -g status-right '#[fg=white]#(host (hostname))'

[Note: I am using the fish shell]

I really want it to be:

set -g status-right '#[fg=white]#(hostname)@#(host (hostname) | cut -d " " -f 4)'

But since I can't get the former status bar to work, this is a lost cause. The weird thing is I got the first one to work once, but then I added the cut.

1 Answer 1

15

Try this:

set -g status-right '#[fg=white]#(hostname)@#(host `hostname` | cut -d " " -f 4)'

The documentation for tmux says that commands inside #() are sh commands. I couldn't get $() to work, but the backticks do.

1
  • Thanks. I completely missed that it didn't use my default shell.
    – wdkrnls
    Commented Jan 23, 2011 at 15:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .