Xref: utzoo comp.unix.misc:938 comp.windows.misc:1801 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!sgi!shinobu!odin!westworld.esd.sgi.com!erik From: erik@westworld.esd.sgi.com (Erik Fortune) Newsgroups: comp.unix.misc,comp.windows.misc Subject: Re: prompt question Message-ID: <1991Feb8.003607.10413@odin.corp.sgi.com> Date: 8 Feb 91 00:36:07 GMT References: <1991Jan23.083259.16296@daimi.aau.dk> <51331@sequent.UUCP> Sender: news@odin.corp.sgi.com (Net News) Reply-To: erik@westworld.esd.sgi.com (Erik Fortune) Organization: Silicon Graphics Inc. Lines: 45 Hah! You want silly, extreme prompts? Here's an excerpt from *my* aliases file: (-: alias back 'cd $lastdir' alias cd 'cd \!:* ; ExitDir ; FixLocation ; FixPrompt ; EnterDir' alias ExitDir 'set lastdir=${thisdir}' alias EnterDir 'set thisdir=${cwd} ; FixPrompt' #aliases to make cd,pushd,and popd understandable if ( ! $?PROMPTCOMMENT ) setenv PROMPTCOMMENT "" if ( ! $?CDENTER ) setenv CDENTER .cdinit.cmd if ( ! $?CDEXIT ) setenv CDEXIT .cdexit.cmd if ( ! $?rev_vid ) setenv rev_vid "" if ( ! $?norm_vid ) setenv norm_vid "" if ( ! $?host_pfx ) setenv host_pfx "" if ( ! $?thisdir ) set this_dir = . if ( ! $?lastdir ) set last_dir = . alias EnterDir 'if (-e "$thisdir/$CDENTER") source $thisdir/$CDENTER' alias ExitDir 'if (-e "$thisdir/$CDEXIT") source $thisdir/$CDEXIT' alias FixLocation 'set lastdir = "$thisdir";set thisdir = "`pwd`"' alias FixPrompt 'set prompt="${host_pfx}${rev_vid}<${HOST}:${PROMPTCOMMENT}${cwd:t}>${norm_vid} "' I use color xterm, and the $host_pfx is the escape sequence to change xterm foreground and background colors, so the color of my window varies with the host I'm talking to. If I'm not on an xterm (but I am on ansi), it changes the colors of prompt depending on the host I'm currently logged into. The $rev_vid is the escape sequence to set whatever terminal I'm on into reverse video, $norm_vid sets it back. A session looks like this (I'm rlogged in to "piranha" in a directory /mumble/mumble/blah: [ xterm is white on navy, prompt is navy on white ] ~^Z [ xterm changes color to white on firebrick, prompt is firebrick on white ] It's ugly, but I love it. Oh, yeah. If a directory has a file named .cdinit.cmd in it, the file is sourced whenever I cd into the directory. If a directory has a .cdexit.cmd, the file is sourced when I leave. I have local aliases for lots of directories. -- Erik