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 use this hardstatus in my .screenrc

hardstatus string '%{= kK}[ %h ] %-Lw%{= KW}%50>%n%f %t%{= kK}%+Lw%< %{=kG}%-= %1` %d %M %c%{-}%{= kK} '

but in macOS the %h not work, don't show the hostname. Any idea ? many thanks.

share|improve this question

2 Answers 2

I think this is a screenrc (host-level, not personal) configuration issue.

I see the same behavior on my OS X 10.6 (snow leopard) machine with the screen that comes installed with OS X (located in /usr/bin/screen).

I then installed screen from MacPorts and the %h tracked the changes to my Terminal window title bar as you desire.

They look like they're essentially the same version, but I notice that there is no global screenrc file in /etc/screenrc (where I would expect to find it for the /usr/bin/screen version) and there is a file in /opt/local/etc/screenrc which has a bunch of termcap and terminfo commands. My guess is that somwhere in here is the magic which allows screen to follow the changes to the title bar and thus the changes for %h.

You have two options:

  • Install screen from MacPorts (sudo port install screen -- assuming, of course, that you already have the core MacPorts installed)
  • Ask nicely for the /opt/local/etc/screenrc file which MacPorts installed. Try putting it into /etc/screenrc and see if it works. (I put the copy from my machine in this paste bin site entry. It will be there for about 30 days before it's autodeleted)
share|improve this answer
    
I compiled from source, but the problem persists –  juanpablo Mar 13 '10 at 0:40
    
Did the version you built install a non-empty /etc/screenrc file? –  Doug Harris Mar 15 '10 at 19:12
    
... or where ever your compiled version of screen expects the global screenrc to live. You can determine this by looking at the output of strings /path/to/screen | grep screenrc. /usr/bin/screen shows "/private/etc/screenrc" –  Doug Harris Mar 15 '10 at 19:17

Try %H:

hardstatus string '%{= kK}[ %H ] %-Lw%{= KW}%50>%n%f %t%{= kK}%+Lw%< %{=kG}%-= %1` %d %M %c%{-}%{= kK} '
share|improve this answer
    
yes, I try with H, but hostname not change in a ssh conection how to in linux. –  juanpablo Mar 11 '10 at 18:35
    
Oh, you want it to change when you SSH into a new system? I don't think that's possible. I could be wrong. –  Josh Mar 11 '10 at 20:22
    
with "%h" this is posible, I tested in a debian –  juanpablo Mar 12 '10 at 0:36
    
Wow. I didn't know it would do that. Pretty cool. –  Josh Mar 12 '10 at 0:41

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.