Xref: utzoo comp.unix.misc:951 comp.windows.misc:1806 Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zaphod.mps.ohio-state.edu!mstar!mstar.morningstar.com!bob From: bob@MorningStar.Com (Bob Sutterfield) Newsgroups: comp.unix.misc,comp.windows.misc Subject: Re: prompt question Message-ID: Date: 8 Feb 91 15:09:11 GMT References: <1991Jan23.083259.16296@daimi.aau.dk> <51331@sequent.UUCP> <1991Feb8.003607.10413@odin.corp.sgi.com> Sender: usenet@MorningStar.COM (USENET Administrator) Reply-To: bob@MorningStar.Com (Bob Sutterfield) Organization: Morning Star Technologies Lines: 35 In-Reply-To: erik@westworld.esd.sgi.com's message of 8 Feb 91 00:36:07 GMT I like to have my pwd in my xterm window's title stripe, and the time of day in the shell prompt. I also like to have the prompt in inverse-video if I happen to be doing rootly things at the moment, just to warn me of the increased probability that I'm about to break something. I use cshe, a local csh variant. %t gives the current time string and %S/%s shift inverse/normal video, as per the termcap entry. Most of the prompt string substitution capabilities (or something similar) are also available in tcsh and its descendants. In the .cshrc excerpt below, I've changed actual escape and bell characters into their equivalent two-character graphic representation. It could probably be done prettier in csh, or cleaner in ksh functions, but you get the idea. # set host=(`hostname | tr '.' ' '`) setenv HOST $host[1] # # interactive shell? if (! $?prompt) exit # if ($?DISPLAY) then alias precmd 'echo -n "^[]0;"{$HOST}":$cwd^G"' set prompt="%t> " if ($?uid) then if ($uid == 0) set prompt="%S%t>%s " endif else set prompt={$HOST}":%/> " if ($?uid) then if ($uid == 0) set prompt={$HOST}":%S%/>%s " endif endif #