X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_TX X-Spam-Check-By: sourceware.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:x-originating-ip:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to :content-type:x-gm-message-state; bh=pRvhCXSeJj+aj78qSC7Si11mJ5Lv+lVS6JiLMohssAE=; b=jxvzDFkkqmhA16j3pt+FL/MxJnjrbnmenoEv85ylVALQg/J1Ya6ic80jlhCZecJU3H Z9pCvrv0fGmvBrtcGwzcWwsY+nie/gHf3x3wVR0hK5BPK502NzujTLRcogbG7pAJ45Fa +AGDoIHSa4WTHFBTY9Q6zUnX1k7qyE6f5w/3XsfuwK8UJVzuslP+T7LPzcS9HOixsJ0d lZZRGoRzavina+28g/FDz2qC8VWPdclQv3VJUhiaRRlvR+B4gu0taCcsgGFrM5fPleKg 1Dq4VTdocP4egQMYLDwbOAlTvCb2YNNRvTk09NMYxwp17qLsevlFIdUkj1mCv6jZ4Gp1 IV0Q== X-Received: by 10.194.156.170 with SMTP id wf10mr4823236wjb.25.1361979428240; Wed, 27 Feb 2013 07:37:08 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <26949.1361935259@relay.known.net> References: <15470 DOT 1361923720 AT relay DOT known DOT net> <512D7040 DOT 7080905 AT gmail DOT com> <26949 DOT 1361935259 AT relay DOT known DOT net> From: Robert Pendell Date: Wed, 27 Feb 2013 10:36:38 -0500 Message-ID: Subject: Re: startxwin started bash does not read .bashrc or .bash_profile To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQnikGUO9FRRdRvXyxQPvG2Vdl4xMwIlZ8QfwPmriXSNxS6lHeENTFGFMh9JBDzvQz09PIdp X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Tue, Feb 26, 2013 at 10:20 PM, Kevin Layer <> wrote: > Arthur Tu wrote: > >>> On 2/27/2013 8:08 AM, Kevin Layer wrote: >>> > If I put this into .startxwinrc: >>> > >>> > mintty /usr/bin/bash.exe --login -i >>> > >>> > the resulting shell does not read .bash_profile. If I put >>> > >>> > mintty /usr/bin/bash.exe -i >>> > >>> > it doesn't read .bashrc. >>> > >>> > >>> > I've been beating my head against this wall for hours, over a few >>> > days. I've googled my ass off, but I can't find anyone that's having >>> > the same problem. >>> > >>> > >>> > My ultimate goal is to use ssh-agent/ssh-add to make life easier, but >>> > it requires my .bashrc to be sourced (.bash_profile merely sources >>> > .bashrc). >>> > >>> > >>> > Thanks. >>> > >>> > >>> ## .bash_profile >>> if [ -f "${HOME}/.bashrc" ] ; then >>> source "${HOME}/.bashrc" >>> fi >>> >>> What do you mean? Isn't this enough? > > It is not. As I said, without --login, when .bashrc would be loaded > directly... it is *not*. > > This should be pretty easy for someone to test. Does it work for > anyone else, as I've described? > > I'm up to date on my installation as of today. > .bashrc and .bash_profile serve 2 different purposes. .bash_profile is meant for login sessions (like ssh or a local terminal) .bashrc is meant for non-login sessions (like scp) Commonly .bash_profile does source in .bashrc so that it gets executed too. BTW, You don't need to do --login and -i. --login will assume -i anyways. Dummy run on my linux box (I'll check cygwin later when I get a chance) but this is for behavior check. shinji AT icarus:~$ bash --login shinji AT icarus:~$ echo $BASHRC Y shinji AT icarus:~$ echo $BASH_PRO Y shinji AT icarus:~$ exit logout shinji AT icarus:~$ bash -i shinji AT icarus:~$ echo $BASHRC Y shinji AT icarus:~$ echo $BASH_PRO Note I placed an export statement in .bash_profile and .bashrc to mark if they got executed. Note that on the login shell both did get executed and on the non-login one (forced interactive) only .bashrc was run. .bashrc is sourced thanks to /etc/profile on my linux system. References: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html http://www.gnu.org/software/bash/manual/bashref.html#Invoking-Bash Bash man page Robert Pendell A perfect world is one of chaos. -- 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