This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: .bashrc file not run


The ~/.bashrc file wasn't called by default and altering ~/.profile did fix the problem.
The comments in /etc/profile seem to imply that ~/.bashrc should be run
on a per user basis automatically, but this was not the case.

...
# Setup some default paths.  Note that this order will allow user installed
#  software to override 'system' software

# If you wish to change the path for all users, it is recommended you edit
#  /etc/bash.bashrc

# If you wish all future users to have some default setup, it is recommended you
#  edit /etc/skel/.bashrc

# If you wish to change the path on a user by user basis, it is recommended you
#  edit ~/.bashrc
...

/etc/skel/.bash_profile does have the code to call ~/.bashrc, but it doesn't seem to get used.

...
# source the users bashrc if it exists
if [ -e "${HOME}/.bashrc" ] ; then
  source "${HOME}/.bashrc"
fi
...


I still need to start bash without --login however as any settings such
as PATH that are configured in ~/.bashrc are lost, but it does run the
~/.bashrc file.

Neil


----- Original Message ----
From: John Morrison <john@morrison.mine.nu>
To: cygwin@cygwin.com
Sent: Fri, February 12, 2010 8:26:24 AM
Subject: Re: .bashrc file not run

~/.bash_profile should already be setup to call ~/.bashrc

it should have been in the base-files package which creates the /etc/skel
files which should be copied when the user first log's on.

AFAIK bash doesn't use a ~/.profile file.  I *think* it's the KORN shell
that does... do you mean /etc/profile?

J.

On Thu, February 11, 2010 4:28 pm, Neil Blue wrote:
> Great,
>
> Thank you both. I now have .bash_profile calling ~/.bashrc.
>
> Just had a look at the ~/.profile script on my linux box and I can see
> where it is making the call to the local ~/.bashrc file
>
> ...
> # if running bash
> if [ -n "$BASH_VERSION" ]; then
>     # include .bashrc if it exists
>     if [ -f "$HOME/.bashrc" ]; then
>         . "$HOME/.bashrc"
>     fi
> fi
> ...
>
> I guess I am too used to having this already set-up for me.
>
> Thanks again for the help.
>
> Cheers
> Neil
>
>
>
> ----- Original Message ----
> From: Csaba Raduly <rcsaba@gmail.com>
> To: cygwin@cygwin.com
> Sent: Thu, February 11, 2010 3:30:15 PM
> Subject: Re: .bashrc file not run
>
> On Thu, Feb 11, 2010 at 4:06 PM, Thomas Wolff  wrote:
>> On 11.02.2010 15:55, Neil Blue wrote:
>>
>> By design (and documentation), bash runs *only* .profile (and
>> /etc/profile)
>> if started as a "login shell".
>
> Not quite.
> From "info bash" , Node: Bash Startup Files
>
> When Bash is invoked as an interactive login shell, or as a
> non-interactive shell with the `--login' option, it first reads and
> executes commands 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.
>
>
> Note to Neil: .bashrc_profile is ignored by bash. You want .bash_profile
>
> Hope this helps.
> --
> Life is complex, with real and imaginary parts
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>
>
>
>
> --
> Problem reports:      http://cygwin.com/problems.html
> FAQ:                  http://cygwin.com/faq/
> Documentation:        http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>
>
>



--
Problem reports:      http://cygwin.com/problems.html
FAQ:                  http://cygwin.com/faq/
Documentation:        http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


      

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]