startxwin started bash does not read .bashrc or .bash_profile

Andrey Repin anrdaemon@freemail.ru
Fri Mar 1 17:35:00 GMT 2013


Greetings, Chris J. Breisch!

> On 3/1/2013 10:49 AM, Kevin Layer wrote:
>>
>> Don't have cron running.  I start it as me, the logged in user, from a
>> mouse click or running "startxwin" in a mintty.  Behaves the same
>> either way.

> Well, I am unable to duplicate this no matter what I do. I have even 
> launched a dash shell directly from cmd.exe and done a startxwin from that.

> I do have the following additions at the beginning of my .bashrc and 
> .bash_profile

> .bashrc:

> [[ "$-" != *i* ]] && return
> export BASHRC=${HOME}/.bashrc
> if [ "${BASH_PROFILE-unset}" = "unset" ]; then
>      source ${HOME}/.bash_profile
> fi

That's a weird way of doing this, if you ask me...
Normally (or, "in the Linux distributions I've been able to check"), .profile
sourcing the .bashrc.
The solution would be to launch bash with --rcfile=~/.profile

> .bash_profile:
> export BASH_PROFILE=${HOME}/.bash_profile
> if [ -f "${HOME}/.bashrc" ] ; then
>    if [ "${BASHRC-unset}" = "unset" ]; then
>      source "${HOME}/.bashrc"
>    fi
> fi

This is even weirder way of doing things.

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

Naturally, if you start with --rcfile set to .profile, your normal rcfile will
still be included.

> That's a little bit of overkill, but it ensures that both my 
> .bash_profile and .bashrc are sourced if I am in an interactive shell.

I'm unsure of the origin of this mess, but it's really should not be an issue.
Probably need to investigate whole chain, that leading to the bash being
started without .profile being run at least once in the meantime.

> For consistency, I should do a check for existence of the .bash_profile 
> before I source it in the .bashrc, just as I do with the .bashrc in 
> .bash_profile. But from a purist standpoint that's hardly the only thing 
> I'm doing wrong here.

> I do not have an .xinitrc. I do have an .Xdefaults, but it just has some 
> xterm display stuff in it.


--
WBR,
Andrey Repin (anrdaemon@freemail.ru) 01.03.2013, <21:19>

Sorry for my terrible english...


--
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



More information about the Cygwin mailing list