Re^2: Prompt as Current Directory?

Rich Geiger rmg at ultra.com
Mon Nov 20 05:09:21 AEST 1989


>In article <Nov.16.00.56.12.1989.9985 at paul.rutgers.edu> 
>broadman at paul.rutgers.edu (Alan Broadman) writes:
>>
>>I have a (hopefully) simple question. How can you get the UNIX prompt
>>to always reflect the path to the current directory.

I find it nice to always have the cwd displayed (one less register to
keep in my very limited brain-cache), but find that having it appear
on the prompt line itself has drawbacks; often, we work with looooong
paths to the cwd (up to or over 80 characters!), and somehow

  /usr/baziotes/projs/releases/source/lint/obj/debug/notes/private %

as a prompt is somewhat irritating. Doesn't leave much space for
typing a command, either!

One approach that has proved useful is to use an area _outside_ of the
normal scrolling area of the terminal (or window) to display the cwd.
For example, on VT100s (or any good VT100 emulation), there is an
escape sequence to set up separate scolling areas; window systems
often allow you to fiddle with the title bar; many terminals have
independent status lines. The .cshrc (or equivalent) script can be set
up to inject the escape sequences needed to put the cwd into the
special area, and then put the cursor back to the main scrolling
before displaying the prompt line. These go into $prompt or $PS, just
as Paul suggests.

Setting all of this up can take some time, and you will probably end
up with some code in your .cshrc (or .profile, or whatever), to handle
different terminal types; on terminals that don't offer a suitable
region for the cwd display, you can revert to using pwd.
-- 
 - Rich Geiger
Disclaimer: I didn't mean it _that_ way...
Ultra Network Technologies / 101 Dagget Drive / San Jose CA 95134
rmg at ultra.com  ...!ames!ultra!rmg  (408) 922-0165 [w]  (408) 739-7911 [h]



More information about the Comp.unix.questions mailing list