Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 8 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.