cshrc to bashrc??

Polytropon freebsd at edvax.de
Sat Jan 1 18:02:27 UTC 2011

On Sat, 1 Jan 2011 10:56:24 -0500, Chris Brennan <xaero at xaerolimit.net> wrote:
> >
> > > Note that csh does automatically use % or # according to the
> > > first setting. I'm not sure how bash handles this.
> >
> man bash and search for PROMPTING, everything you can pass PS1 is there
> # is \#     the command number of this command
> I don't see how a '%' is handled tho, what does it do is csh? I (or someone
> else) may know the bash equivalent...

The csh and bash config do use differnt "escape sequences"
for substitution, such as user name, host name, current
directory and "power" (root / non-root). In bash it is \,
in csh it is %.

You are right, "man bash" does list all the sequences,
as well as "man csh". For the standard prompt

	user at host:~/my/path% _

those are the corresponding codes:

Meaning		csh	bash
--------------	------	------
user		%n	\u
host		%m	\h
path		\w	%~	(includes substitution ~)
prompt sign		%#	(# for root, % for non-root)
		\$		(# for root, $ for non-root)

That's why I said csh's set prompt = "%n@%m:%~%# " equals
bash's export PS1="\u@\h:\w\$ ", because bash does have a
different default prompt (which might not be desired).

A literal % can be used for bash's PS1 setting if intended.
But it's okay to see $ for bash, and % for csh.

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

More information about the freebsd-questions mailing list