Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Nov 1999 09:05:52 +1000 (EST)
From:      Colin Campbell <sgcccdc@citec.qld.gov.au>
To:        Oren Sarig <sarig@bezeqint.net>
Cc:        Guillaume Paquet <foub@globetrotter.net>, freebsd-questions@FreeBSD.ORG
Subject:   Re: prompt and default editor
Message-ID:  <Pine.LNX.4.10.9911260856510.19352-100000@guru.citec.qld.gov.au>
In-Reply-To: <05a601bf3772$4ba57fc0$470cb3d4@asmodean>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Thu, 25 Nov 1999, Oren Sarig wrote:

> 1) How can I change my prompt? like myhostname@pwd$
>     I'd like to have an example please.
> 
> It depends on the shell, for example, in bash you would do a
> PS1="<your prompt>"; export PS1
> 
Here's a PS1 I developed for ksh/bash/...

PS1="`uname -n|cut -f1 -d.` "'${PWD%%/*/*}${PWD##${PWD%/*/*}} \$ '

For root, I add "|tr a-z A-Z" between the "d." and the "'" (uppercases the
hostname so I can tell easier if I am root or me).

It has the "magical" feature of showing only the last two components of
the cwd. I like having some indication of where I am in the file system,
but I also really hate having a prompt that fills the whole line. Here's
an example:

	Hostname = myhost.my.domain.com
	pwd = /usr/local/share/doc/apache

	If I am me it looks like:

	myhost /doc/apache # 

	and if I am root it looks like

	MYHOST /doc/apache # 

Colin



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.10.9911260856510.19352-100000>