Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 10 down vote accepted

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.

share|improve this answer
    
Thanks. I completely missed that it didn't use my default shell. – wdkrnls Jan 23 '11 at 15:30
2  
@wdkrnls: If this answer was helpful, please mark it as accepted. – Dennis Williamson Jan 23 '11 at 15:35

You must log in to answer this question.

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