Date: Thu, 29 Jul 2004 15:32:12 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Dan <longterm@pdx.chatusa.com> Cc: freebsd-questions@freebsd.org Subject: Re: freeBSD How to you set the prompt Message-ID: <20040729143212.GB28698@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <000801c47570$25df3ab0$ca2aeecd@dannewxp> References: <000801c47570$25df3ab0$ca2aeecd@dannewxp>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Thu, Jul 29, 2004 at 01:29:30PM -0000, Dan wrote:
> Where and how do you set the prompt to show what user name that your on IE ROOT or user johndoe.
> Eample of what the end results I would like to see.
>
> # router1.pdx/chatusa.com user johndoe.
Depends on what shell you're using. Assuming that you meant to type
'router1.pdx.chatusa.com' as the fully qualified hostname, then for
tcsh(1):
set prompt="# %M user %n "
For bash(1):
PS1="# \H user \u "
For zsh(1):
prompt="# %M user %n "
For sh(1), which doesn't have any sort of escape character support for
its prompts, you'ld have to do something like:
PS1="# $(hostname) user $(id -un)"
which just uses the regular string substition features supplied by the
shell. [The difference is immaterial here, but if you wanted, say, to
display the current working directory in your shell prompt, the
%-escape or \-escape style would do it without any fuss. The sh(1)
style means you'ld have to arrange to reset the prompt each time you
changed directory.]
Cheers,
Matthew
--
Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks
Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614 Bucks., SL7 1TH UK
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)
iD8DBQFBCQpsiD657aJF7eIRAnQiAKCikSoojHI2XwluxMeOZa9+c3SF3gCgiEg3
GVXAbvccVkSh6K9vF5uhgJI=
=FiqD
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040729143212.GB28698>
