delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/22/15:19:14

From: "Mark E." <snowball3 AT bigfoot DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: bash 2.04: $# not preserved?
Date: Mon, 22 Oct 2001 15:09:37 -0400
Organization: Snowball's Web
Message-ID: <m6r8ttc1ccccafdl6gqm6d84tiftk5oq5t@4ax.com>
References: <20011018115345 DOT A21027 AT kendall DOT sfbr DOT org>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
NNTP-Posting-Host: 12.64.188.164
X-Trace: 22 Oct 2001 19:05:44 GMT, 12.64.188.164
Lines: 34
X-Complaints-To: abuse AT prserv DOT net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

JT Williams <jeffw AT darwin DOT sfbr DOT org> wrote:

>Can anyone confirm the following behavior
>with the djgpp port of bash 2.04?  TIA/jtw
>
>djdev 2.03; bash 2.04
>---------------------

>foo: after bar: n=3             <- n=3 !?
>
>Solaris
>-------

>foo: after bar: n=1             <- n=1  (as expected)

A comment in builtins/source.def does say:
/* If this . script is supplied arguments, we save the dollar vars and
   replace them with the script arguments for the duration of the script's
   execution.  If the script does not change the dollar vars, we restore
   what we saved.  If the dollar vars are changed in the script, and we are
   not executing a shell function, we leave the new values alone and free
   the saved values. */
static void
maybe_pop_dollar_vars ()
{
  if (variable_context == 0 && dollar_vars_changed ())

So -- going by the comment quoted above -- the Solaris example does seem to report
the correct value, but I can't find any code in Bash that detects when the "dollar
vars" have changed and behave like the Solaris example.


-- 
Mark E.: snowball3 AT softhome DOT net

- Raw text -


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