Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!zben From: zben@mimsy.UUCP (Ben Cranston) Newsgroups: comp.unix.questions Subject: Re: prompt wars Message-ID: <5873@mimsy.UUCP> Date: Wed, 18-Mar-87 15:09:58 EST Article-I.D.: mimsy.5873 Posted: Wed Mar 18 15:09:58 1987 Date-Received: Fri, 20-Mar-87 01:53:40 EST References: <1480@umd5> <5823@mimsy.UUCP> Reply-To: zben@mimsy.UUCP (Ben Cranston) Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 22 Summary: All done in one hideous alias In article <5823@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: > Instead of using a shell script and awk, it is much faster to do this: > set hostname=`hostname | sed -e 's/\..*//'` > alias set_prompt 'set prompt="${hostname}[\\!] `dirs|cdt2` % "' > Likewise, using `sed' to change `/usr/spool/news/comp/unix/questions' > to `...unix/questions' is also faster, and if done in an alias rather > than in a shell script, should be as fast as the C program Ben wrote. > The sed commands to do this are left as an exercise to the reader. :-) Well, this alias seems to do the trick. It seems a little slow, but this is mimsy rather than umd5 so I don't have the basis for comparison... alias set_prompt 'set prompt="`hostname|sed -e '\''s|\..*||'\''`[\\!] `dirs|sed -e '\''s| .*||'\'' -e '\''s|.*[^/]\(/[^/]*/[^/]*\)|...\1|'\''` % "' It could probably be decomposed in the way Chris suggests... -- umd5.UUCP <= {seismo!mimsy,ihnp4!rlgvax}!cvl!umd5!zben Ben Cranston zben @ umd2.UMD.EDU Kingdom of Merryland UniSys 1100/92 umd2.BITNET "via HASP with RSCS"