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

Path csiph.com!goblin3!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
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 Mon, 29 Jul 2019 19:25:54 +0300
Lines 25
Approved bug-bash@gnu.org
Message-ID <mailman.155.1564417568.1985.bug-bash@gnu.org> (permalink)
References <5D3E9154.2030007@tlinx.org> <9f1ca322-09f6-a151-e13f-a053cf0ab89a@iki.fi>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1564417569 19656 209.51.188.17 (29 Jul 2019 16:26:09 GMT)
X-Complaints-To action@cs.stanford.edu
To L A Walsh <bash@tlinx.org>, bug-bash <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:60.0) Gecko/20100101 Thunderbird/60.8.0
In-Reply-To <5D3E9154.2030007@tlinx.org>
Content-Language en-US
X-SASI-RCODE 200
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; h=subject:to:references:from:message-id:date:mime-version:in-reply-to:content-type:content-transfer-encoding; s=smtp; bh=dfTNCIREnwRh2MlCQd6kGpeCR6gY8sVaRPNmpPpXIss=; b=tZDCeGZrFd585XbOs327AcyR9wWSfJB6QWyI51H1bwwKO/XXnKL0GhD98rj0U9O+uMJ5Gh3NpKNZ9b59A+bLqX//+mDpecwNHxZAs6ZWcyeJpE3zOXMwRqEJzxGYF8l8UflauvPJGTp/loZoSscaXUiXN6zqPI8OgFJaTVkyIqxFEkm5nLAoOoNLU3mNnuoxx23zRo8+CteU+aDq8S4gEtM6ptP5LWQdkJBWZj/MTybLxJ7bacMvSMiRrey3Q+UJn90zARCOSc/yl4OE13TxZdwubs56tzhL3+U+4NQKe7pfiYIYRq1YgUhE2sJVKVhjvp4JbdnG8UiegVajAk4l1w==
X-detected-operating-system by eggs.gnu.org: FreeBSD 8.x
X-Received-From 157.24.2.213
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <9f1ca322-09f6-a151-e13f-a053cf0ab89a@iki.fi>
X-Mailman-Original-References <5D3E9154.2030007@tlinx.org>
Xref csiph.com gnu.bash.bug:15259

Show key headers only | 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