Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15259

Re: Have var+func sourced in a subroutine but they don't seem to end up in same scope

From Ilkka Virta <itvirta@iki.fi>
Newsgroups gnu.bash.bug
Subject Re: Have var+func sourced in a subroutine but they don't seem to end up in same scope
Date 2019-07-29 19:25 +0300
Message-ID <mailman.155.1564417568.1985.bug-bash@gnu.org> (permalink)
References <5D3E9154.2030007@tlinx.org> <9f1ca322-09f6-a151-e13f-a053cf0ab89a@iki.fi>

Show all headers | View raw


On 29.7. 09:25, L A Walsh wrote:
> The library-include function allows me to source a library file
> that is in a relative path off of PATH (a feature not in bash,
> unfortunately).

[...]

> I tried putting exporting the data and the function with export
> but it ended up the same.  The variables weren't defined in the
> same scope as the function.

Are you sourcing some other script, or running it as a regular program?

Because above, you say 'source', which would indicate running code from 
another file in the same shell, but then you talk about exporting, which 
really only matters when starting a new process (as far as I know).


An example that would actually run and demonstrate the issue might make 
it easier to see what's actually going on.


-- 
Ilkka Virta / itvirta@iki.fi

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Have var+func sourced in a subroutine but they don't seem to end up in same scope Ilkka Virta <itvirta@iki.fi> - 2019-07-29 19:25 +0300

csiph-web