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


Groups > gnu.bash.bug > #16679

Re: set -u not working as expected

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: set -u not working as expected
Date 2020-08-02 16:41 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.588.1596400901.2739.bug-bash@gnu.org> (permalink)
References <000301d66834$588493c0$098dbb40$@kalvr.net> <F4821044-5F8D-4B6D-A266-BAC88AE3DC2C@larryv.me> <bb9fe19a-f3ea-5908-ebf7-d5ffb4de66a7@case.edu>

Show all headers | View raw


On 8/1/20 8:47 PM, Lawrence Velázquez wrote:

>> let v+=1 # Line 18, Once line 11 is uncommented, Bash fails here
> 
> I haven't seen the code for arithmetic expansion, but I assume it
> treats v+=1 as morally equivalent to v=${v}+1 (à la C99). Thus there
> *is* an expansion, which fails under set -u. Regardless of the
> particulars, ksh and zsh again agree:

This is indeed what happens in an arithmetic context. It happens with
pre- and post-increment and decrement operators, too.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

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


Thread

Re: set -u not working as expected Chet Ramey <chet.ramey@case.edu> - 2020-08-02 16:41 -0400

csiph-web