delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/11/14/13:39:29

X-Spam-Check-By: sourceware.org
Message-ID: <20061114183911.4926.qmail@web32701.mail.mud.yahoo.com>
Date: Tue, 14 Nov 2006 10:39:10 -0800 (PST)
From: Arto Stimms <artost AT yahoo DOT com>
Subject: bash does not retain env when running script
To: cygwin AT cygwin DOT com
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id kAEIdPpd006660

I am running cygwin on a Windows 2000 machine.

I would like to run a bash script with a few changes in the environment. I would expect this to work:

    bash --rcfile init.sh script

But it does not seem that bash retain any of the changes I have made in init.sh?

As a small example I have tried using these two minimal files

init.sh:
    hello () { echo "hello world"; }
    alias listdir=ls

script:
    hello
    listdir

I get the following output:

    $ bash --rcfile init.sh script
    script: line 1: hello: command not found
    script: line 2: listdir: command not found

    $ bash --rcfile init.sh

    $ hello
    hello world

    $ listdir
    init.sh  script

    $ ./script
    ./script: line 1: hello: command not found
    ./script: line 2: listdir: command not found

What can I do to make my changes work in the script?

Best Regards,
  Arto Stimms





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