delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/20/08:09:13

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Hannu E K Nevalainen" <garbage_collector AT telia DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: Problem with noninteractive bash initialization
Date: Thu, 20 Nov 2003 14:08:29 +0100
Message-ID: <NGBBLLIAMFLGJEOAJCCEIEGLDGAA.garbage_collector@telia.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
In-Reply-To: <Pine.GSO.4.56.0311191610560.12731@slinky.cs.nyu.edu>
Importance: Normal

> From: Igor Pechtchanski
> Sent: Wednesday, November 19, 2003 10:15 PM

> On Wed, 19 Nov 2003, Wirawan Purwanto wrote:
>
> > Hi,
> >
> > How should a noninteractive bash begin (i.e. for executing a script)?
> > Should bash read init files like ~/.bashrc, ~/.bash_profile, or
> > /etc/profile? According to bash documentation on
> >
> >   http://www.gnu.org/manual/bash-2.05a/html_mono/bashref.html#SEC62 ,
> >
> > NO initialization files would be read. But cygwin's bash (version
> > 2.05b.0(1)-release) DOES reads and executes ~/.bashrc BEFORE
> executing the
> > actual script itself. Why is this? Is this not a deviation from the
> > prescribed behavior, or what?
<SNIP>
> > Can somebody explain what's wrong with this?
> >
> > Wirawan


> Don't know, WFM:
>
> $ echo '#!/bin/bash
> echo "Hellow"' > xyz
> $ bash -x xyz
> + echo Hellow
> Hellow
> $ bash --version
> GNU bash, version 2.05b.0(1)-release (i686-pc-cygwin)
> Copyright (C) 2002 Free Software Foundation, Inc.
> $
>
> BTW, the #! line is redundant if you invoke the script this way -- bash
> (the one you invoked on the command line) simply interprets the commands
> in it, and #! is ignored.
> 	Igor

$ man bash
/--login

--8<----
       --login
              Equivalent to -l.

<SNIP>
       --noprofile
              Do  not read either the system-wide startup file /etc/profile
or
              any  of  the  personal  initialization  files
~/.bash_profile,
              ~/.bash_login,  or  ~/.profile.   By  default,  bash reads
these
              files when it is  invoked  as  a  login  shell  (see
INVOCATION
              below).
--8<----

Looks like W.P's bash acts as a login shell by default. Maybe it is compiled
that way, or "bash" might be a (sym)link or something?

/Hannu E K Nevalainen, B.Sc. EE - 59+16.37'N, 17+12.60'E

** on a mailing list; please keep replies on that particular list **

-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019