Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!mrspoc!itkin From: itkin@mrspoc.Transact.COM (Steven M. List) Newsgroups: comp.unix.xenix.sco Subject: Re: Printing Working Directory in CSH (or SH for that matter) Message-ID: <1991Apr29.201522.972@mrspoc.Transact.COM> Date: 29 Apr 91 20:15:22 GMT References: <46@swatty.UUCP> Reply-To: steven@Transact.COM Organization: Transact Software Lines: 26 root@swatty.UUCP (Superuser) writes: >Does anybody know how to set the prompt in csh so that the current directory >name (eg., /usr/lib/uucp) is printed (kind of like a dos $p$g), also can this >be done is sh... Here's how I do it - works quite nicely, and the delay when changing directories is minimal: set UID = `id | sed 's/uid=\([0-9][0-9]*\).*/\1/'` if ($UID == 0) then set uname = "`uname -n`-ROOT" else set uname = `uname -n` endif alias cd 'chdir \!* ; set prompt = "-${uname}:`pwd`-\! > "' cd . note that the final "cd ." is executed in .cshrc when the alias is set up so that the prompt will be set the first time. -- +----------------------------------------------------------------------------+ : Steven List @ Transact Software, Inc. :^>~ : : Chairman, Unify User Group of Northern California : : itkin@Transact.COM :