rmg@ultra.com (Rich Geiger) (11/20/89)
>In article <Nov.16.00.56.12.1989.9985@paul.rutgers.edu> >broadman@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@ultra.com ...!ames!ultra!rmg (408) 922-0165 [w] (408) 739-7911 [h]
scott@memex.co.uk (Scott Williamson) (11/21/89)
In article <1989Nov19.180921.20357@ultra.com> rmg@ultra.com (Rich Geiger) writes: >>In article <Nov.16.00.56.12.1989.9985@paul.rutgers.edu> >>broadman@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. > >.................................................... 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! > My solution is to only have the last two elements of the pathname in the prompt. This still gives a good reminder as to where you are. The following also includes username and hostname eg. scott [doc: src/pcomm] : For .cshrc: set hn=`hostname` alias cd 'cd \!* ; set cwdh = $cwd:h ; set prompt = "$user [${hn}: $cwdh:t/$cwd:t] : "' alias pushd 'pushd \!* ; cd .' alias popd 'popd \!* ; cd .' cd .