trouble getting .shrc to take

Polytropon freebsd at
Thu Sep 27 05:22:31 UTC 2012

On Wed, 26 Sep 2012 23:08:27 -0600, Gary Aitken wrote:
> Having set my shell to either sh or bash,
> I can't seem to get .shrc to take.
> If I have a .shrc that looks like:
>   PS1=\\w$ ; export PS1
> PS1 is not defined when I log in, and the prompt is set to the default instead.
> If I do
>   ./.shrc
> nothing seems to change;
> although executing the above commands from the shell itself works.
> What am I missing?

As far as I see from "man sh", the system's shell does not
support PROMPT_DIRTRIM, so it's a bash feature.

According to "man bash", its initialisation file is called
~/.bashrc. For example, if I put

	export PS1="\u@\h:\w\$ "

into ~/.bashrc and execute bash, I get a standard prompt. So
it should only be a matter of the correct file name.

Note that bash has several files it can process at startup
time, such as .bash_login, .profile and .bashrc. Their order
is described in the manual, e. g.

	When  bash is invoked as an interactive login shell, or as a non-inter-
	active shell with the --login option, it first reads and executes  com-
	mands  from  the file /etc/profile, if that file exists.  After reading
	that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
	in  that order, and reads and executes commands from the first one that
	exists and is readable.  

	When an interactive shell that is not a login shell  is  started,  bash
	reads  and executes commands from ~/.bashrc, if that file exists.  This
	may be inhibited by using the --norc option.  The --rcfile file  option
	will  force  bash  to  read  and  execute commands from file instead of

You can find more information in the "INVOCATION" section of the
manual at "man bash". There are files for per-user configuration
as well as system-wide files.

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

More information about the freebsd-questions mailing list