delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/11/08/10:17:35

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3A096D47.B01C9627@redhat.com>
Date: Wed, 08 Nov 2000 16:12:07 +0100
From: Corinna Vinschen <vinschen AT redhat DOT com>
Reply-To: cygwin <cygwin AT sources DOT redhat DOT com>
X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.14-SMP i686)
X-Accept-Language: de, en
MIME-Version: 1.0
To: cygwin <cygwin AT sources DOT redhat DOT com>
Subject: Re: missing inheritance of exported shell function
References: <3A0966F3 DOT 34F75B3D AT sicad DOT de>

Helmut Dipper wrote:
> I use following bash-version:
> 
> bash -version delivers:
> GNU bash, version 2.04.0(1)-release (i586-pc-cygwin)
> Copyright 1999 Free Software Foundation, Inc.
> 
> on Windows-NT 4.0 SP5.
> 
> During my tests I found following behaviour:
> 
> Given the definitions
> 
> VAR="xxx" ; export VAR
> function fct() { pwd; } ; export -f fct
> 
> Consider the environments of subsequent started shells:
> 
> - interactive shell "bash"
>   variable VAR and function fct are inherited
> 
> - interactive shell "sh" or
>   shell-script with #!/bin/sh or
>   shell-script with #!/bin/bash
>   variable VAR is inherited but not function fct
> 
> Question:
> Why is there a difference in the inheritance between
> variables and functions?

sh = ash. Ash has no mechanism to export functions.

bash exports functions and if you're using bash as interactive shell
and the shell script has "#!/bin/bash" in the first line, then the
function will be inherited.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                        mailto:cygwin AT sources DOT redhat DOT com
Red Hat, Inc.
mailto:vinschen AT redhat DOT com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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