7.6 Session Information in Your Terminal's Status LineSome people don't like to put the current directory, hostname, etc. into their prompts because it makes the screen look cluttered to them. Here's another idea. If your terminal or window system has a status line or title bar, you might be able to put the information there. That's nice because you'll be able to see the information while you run programs. The bad side is that the information can get out-of-date if you use a command that takes you to another host or directory without updating the status line. When you cd , an alias uses the echo command to write special escape sequences (5.8 ) (terminal commands) to the terminal or window. Here's a cd alias and other commands for your .cshrc file. If I were logged in to www.jpeek.com in the directory /home/jpeek , this alias would put: www:/home/jpeek in the status area.
Of course, you can change the format of the status line.
Change the command string below,
If you always use a VT102-type terminal (and many people do), that alias will work fine. If you use a different terminal, read its manual or its termcap /terminfo entry (41.11 ) and find the escape sequences that work for it. People who use more than one type of terminal, that aren't all VT102-compatible, can add a case (44.5 ) or switch (47.6 ) to test the terminal type and use a cd alias written for that terminal. (The alias can also put the status information in the shell prompt on terminals that don't have a status line.) But you might have some trouble: if the alias is defined in your .cshrc file but your terminal type is set in your .login file, the terminal type may not be set until after the alias has been read. There are workarounds (2.7 ) . The status line can also get out of sync with reality if you use
remote logins (1.33
)
,
subshells (38.4
)
,
and other things.
These might put a new prompt in the status line but not reset the
original prompt when it should be reset.
The easiest workaround for this is by using the command below to
change directory to
the current directory ( % - |
|