Simple exit trap doesn't run in newer versions of bash

2019-01-25 Thread Brad Spencer
Consider the following commands: bash -c 'trap "echo WORKS" EXIT; touch x' (trap "echo WORKS" EXIT; touch x) (trap "echo WORKS" EXIT && touch x) bash -c 'trap "echo WORKS" EXIT; true' bash -c 'trap "echo WORKS" EXIT; false' bash -c 'trap "echo WORKS" EXIT; touch x && a' bash -c 'trap "echo WORKS"

Re: Simple exit trap doesn't run in newer versions of bash

2019-01-25 Thread Eduardo A . Bustamante López
On Fri, Jan 25, 2019 at 11:22:07AM -0400, Brad Spencer wrote: (...) > Now consider this command: > > bash -c 'trap "echo WORKS" EXIT && touch x' > > On newer versions of bash, it produces no output. Substituting different > commands in the trap or tracing it seems to indicate that the trap never

Re: Simple exit trap doesn't run in newer versions of bash

2019-01-25 Thread Chet Ramey
On 1/25/19 10:22 AM, Brad Spencer wrote: > Consider the following commands: > > bash -c 'trap "echo WORKS" EXIT; touch x' > (trap "echo WORKS" EXIT; touch x) > (trap "echo WORKS" EXIT && touch x) > bash -c 'trap "echo WORKS" EXIT; true' > bash -c 'trap "echo WORKS" EXIT; false' > bash -c 'trap "ec

Re: "return" should not continue script execution, even if used inappropriately

2019-01-25 Thread don fong
> > | the "answers" have mostly been about "how to do this". > > Yes, that would be the point, wouldn't it? > no. a discussion thread can have multiple points. one point that arose was someone calling this technique (or python programmers, or both) crazy. that's the one i'm talking about, as i'

Re: UUID as Array Keys strangely not possible

2019-01-25 Thread Robert White
On 1/22/19 10:23 PM, Chet Ramey wrote: On 1/22/19 3:32 PM, Robert White wrote: Howdy, The following cannot work because, for some reason, the array subscript parser insists on doing math on array indices even when the array is associative instead of numeric typeset -A UUID_TABLE ... UUID_TABLE

Re: UUID as Array Keys strangely not possible

2019-01-25 Thread Dennis Williamson
On Fri, Jan 25, 2019, 9:51 PM Robert White On 1/22/19 10:23 PM, Chet Ramey wrote: > > On 1/22/19 3:32 PM, Robert White wrote: > >> Howdy, > >> > >> The following cannot work because, for some reason, the array subscript > >> parser insists on doing math on array indices even when the array is > >>

case statement: wrong behaviour of the ";;&" operator

2019-01-25 Thread Norman Krebs
Configuration Information: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security uname output: Linux hpxz 4.9.37 #1 SMP Sat Jul 15 08:39:05 CEST 2017 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.0 Patch Level: 2 Release

Re: UUID as Array Keys strangely not possible

2019-01-25 Thread Robert White
On 1/26/19 4:37 AM, Dennis Williamson wrote: On Fri, Jan 25, 2019, 9:51 PM Robert White On 1/22/19 10:23 PM, Chet Ramey wrote: On 1/22/19 3:32 PM, Robert White wrote: Howdy, The following cannot work because, for some reason, the array subscript parser insists on doing math on array indices e