Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11749
| Path | csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Eduardo A. Bustamante López <dualbus@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Inconsistency in the handling of variables inside a function when using a tempenv variable |
| Date | Thu, 22 Oct 2015 17:34:49 -0500 |
| Lines | 32 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.840.1445553297.7904.bug-bash@gnu.org> (permalink) |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | usenet.stanford.edu 1445553297 10854 208.118.235.17 (22 Oct 2015 22:34:57 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; bh=6HnrAHXs3abFP6bSDiikYNJO0gzoJK53AwIqZyTGYKk=; b=OTY0dzSNLBUTS5MVGEoW+GCB47/QLL/RP+ko+F2mpWxLHqoyr8hpR5o+1RCGL9uY4q FXKaoDWaVFKGUVlXFfQ3UzsTeFeFj+VVAA/h7p/4ZtS1861fGuOs5Xj4biUyj5+vf+cv lFD+XKd5Jxiip0zf4g1lKcsCs33g2qCM50V8MoPMAH8vk9AXzh+4tOX5iRJiJUE5FPzu +KUJUiLWBLTNsZnxXY5r8I9vWofaaSK86xpLXATTZf7EUCDNxNNkvpF3goledVG84y7Q Jd1XpdLSDQhJs9fJ2thrWJLD0JSr3geKENL1N6//Gzii8tsDBhs1pyDzVlyewhxhDio4 H2sA== |
| X-Received | by 10.66.119.201 with SMTP id kw9mr20457808pab.64.1445553290649; Thu, 22 Oct 2015 15:34:50 -0700 (PDT) |
| Mail-Followup-To | bug-bash@gnu.org |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.23 (2014-03-12) |
| X-detected-operating-system | by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). |
| X-Received-From | 2607:f8b0:400e:c03::22e |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.14 |
| 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 | <http://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> |
| Xref | csiph.com gnu.bash.bug:11749 |
Show key headers only | View raw
I found this some time ago, but didn't report it because I couldn't come up
with a patch:
dualbus@hp ~ % for sh in bash mksh zsh ksh93 dash; do $sh -c 't=${KSH_VERSION+typeset}; f() { x=3; ${t:-local} x; echo $x; }; [ "$(f)" = "$(x=4 f)" ]'; echo $sh $?; done
bash 1
mksh 0
zsh 0
ksh93 0
dash 0
dualbus@hp ~ % bash -xc 'f() { x=3; local x; echo $x; }; f; x=4 f'
+ f
+ x=3
+ local x
+ echo
+ x=4
+ f
+ x=3
+ local x
+ echo 3
3
I'm putting it here so I don't forget about it.
Bash is the only one that handles this: tmpenv - global - local variable chain
in that way.
--
Eduardo Bustamante
https://dualbus.me/
Back to gnu.bash.bug | Previous | Next | Find similar
Inconsistency in the handling of variables inside a function when using a tempenv variable Eduardo A. Bustamante López <dualbus@gmail.com> - 2015-10-22 17:34 -0500
csiph-web