This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: missing inheritance of exported shell function


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@sources.redhat.com
Red Hat, Inc.
mailto:vinschen@redhat.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]