Re: Virtual Console Indicator
Miquel van Smoorenburg (miquels@drinkel.ow.org)
Sun, 13 Nov 1994 17:44:06 +0100 (MET)
In article <39tgav$3ed@neneh.it.com.au>, Simon Mackinlay <sjm@it.com.au> wrote:
>[On comp.os.linux.misc Harald T. Alvestrand bellowed unto all...]
>: Under tcsh, in .cshrc:
>
>: if ($?prompt) then
>: setenv TTY `tty | sed -e s:/dev/tty::`
>: set prompt="%m($TTY):%~%# "
>: endif
>
>: Result:
>
>: dale(p0):~>
>
>It's moments like these that I like the col* heirarchy...
>
>Now - who wants to tell me how to do this with bash?
>
Allright here it is:
hostname=`hostname`
tty=`tty`
PS1="[${hostname%%.*}(${tty#/dev/tty}):$LOGNAME](\w)> "
|<----------->| |<----------->| |<---->| |<>|
(1) (2) (3) (4)
1. Hostname with domainname stripped off.
2. Tty device minus /dev/tty
3. Login name.
4. Working directory.
Mike.
--
| Miquel van Smoorenburg -- miquels@drinkel.ow.org |
| "Life's too short to use Windows" |