Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jan 2014 08:41:30 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Fbsd8 <fbsd8@a1poweruser.com>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: set prompt for new users
Message-ID:  <20140118084130.a9b78380.freebsd@edvax.de>
In-Reply-To: <52DA24A4.8010804@a1poweruser.com>
References:  <52D87D89.1060606@a1poweruser.com> <20140117183438.21f60837.freebsd@edvax.de> <52DA24A4.8010804@a1poweruser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 18 Jan 2014 14:52:20 +0800, Fbsd8 wrote:
> I use pw adduser command to add new users to the host. From the prompt I 
> get when logging on to a new user I see the prompt format used in 
> /usr/share/skel/dot.cshrc.
> 
> How is /etc/csh.cshrc used to set prompt for all users?

By precedence. :-)

In order to have all (new) users benefit from what's been
configured globally in /etc/csh.cshrc, make sure their
~/.cshrc is empty (or at least does not override $prompt).
The easiest way to make sure is to empty the template for
this file in /usr/share/skel/dot.cshrc. Local files have
precedence over global files.

In your /etc/csh.cshrc, just modify the part for the
interactive shells like this:

	if ($?prompt) then
		set promptchars = "%#"
		set prompt = "%n@%m:%~%# "
		set autolist
		# ... more stuff ...
	endif

For a typical Linux bash-like prompt, use something like this:

	set promptchars = '$#'
	set prompt = "[%n@%m] %~ %# "

The C shell also has support for bold print and colors.
The codes are listed in the manpage.

Note that you can also use /etc/csh.login and /etc/csh.logout
to globally set the actions at login and logout time for
users with interactive shells. Their respective local files,
~/.login and ~/.logout, should be empty to allow this
mechanism.

See the "FILES" section in "man csh" for details.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140118084130.a9b78380.freebsd>