Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!agate!darkstar!cats.ucsc.edu!bjsvec From: bjsvec@cats.ucsc.edu (Brandon Jason Svec) Newsgroups: comp.unix.questions Subject: cwd in promt (summary) Message-ID: <17186@darkstar.ucsc.edu> Date: 18 Jun 91 22:21:55 GMT Sender: usenet@darkstar.ucsc.edu Distribution: comp.unix.questions Organization: University of California, Santa Cruz; Open Access Computing Lines: 55 Thanks for all the prompt responses to my prompt question. Here is a short summary of the first three responses I got. I personally recommend the second one since it short and sweet. ---------------- alias pwd 'echo $cwd' alias cd 'cd \!*; set prompt="`hostname`:$cwd>"' alias popd 'popd \!*; set prompt="`hostname`:$cwd>"' alias pushd 'popd \!*; set prompt="`hostname`:$cwd>"' Thanks to: Kees denHartigh ---------------- alias cd 'cd \!*;set prompt = "$HOST [$cwd] % "' Thanks to: James Cameron ---------------- alias cd 'cd \!*;set prompt="`whoami`@`hostname`:`truncdir.$ARCH` [\\!] "' cd . which gives me something like this: steve@orchid:.../tina/modules/sd [7] I have a little program called "truncdir", which prints out a string containing the last three components of the path. Here's what it looks like: main() { register int pos,num_dirs; register char directory[100]; getwd(directory); pos = strlen( directory ); num_dirs = 1; while( num_dirs <= 3 && --pos > 0 ) if( directory[pos] == '/' ) num_dirs++; if( pos > 0 ) printf( "..." ); printf( &directory[pos] ); } Install this program with the sticky bit set so it stays resident, and it works great! Thanks to: Steve Sandke ------------------ brandon@cats.ucsc.edu