Proposal: new PROMPT $i special command.

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
I move around my laptop quite a bit, connecting it to several networks (work, home, mistress' home :p, etc.), and each time it gets assigned a different IP address.

My current prompt says somewhere ... $u@%_ip ... , but the problem with this is that %_ip gets evaluated only at the window startup, and if I move to a new network, the old IP address will still be there. A workaround is to simply close that TCC window and open another one, but there are many times where this is undesirable.

I'd like to have the new special command $i available for the prompt: it will display the current IP address(es), just like the %_ip variable does.

Thanks.

(It's been a while since I last participated - I apologize if this has been flogged to death before)
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,376
39
Albuquerque, NM
prospero.unm.edu
#2
I move around my laptop quite a bit, connecting it to several networks (work, home, mistress' home :p, etc.), and each time it gets assigned a different IP address.

My current prompt says somewhere ... $u@%_ip ... , but the problem with this is that %_ip gets evaluated only at the window startup, and if I move to a new network, the old IP address will still be there. A workaround is to simply close that TCC window and open another one, but there are many times where this is undesirable.
Try this:

Code:
prompt $u@%%_ip $g
Or this:

Code:
prompt `$u@%_ip $g`
Either way will store the literal string %_ip in the PROMPT variable to be evaluated when the prompt is displayed.