prompt wars

chris at mimsy.UUCP chris at mimsy.UUCP
Sun Mar 15 16:12:53 AEST 1987


In article <1480 at umd5> zben at umd5 (Ben Cranston) writes:
>   alias set_prompt 'set prompt="`hnm1`[\\!] `dirs|cdt2` % "'

>in "~/bin/hnm1":

>   #! /bin/sh
>   # output user-friendly head of host name
>
>   hostname | awk -F. '{ print $1 }'

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. :-)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris at mimsy.umd.edu



More information about the Comp.unix.questions mailing list