On Fri, Jun 13, 2025 at 07:08:21 -0600, Stan Marsh wrote: > BTW, and only tangentially related, "man bash" says that "let" and "(( ))" are > exactly the same, but "shellcheck" thinks otherwise. "shellcheck" says you > should > use "(( ))" and never use "let", but I still (mostly) use "let".
And Greg replied: >That's peculiar. I'm not sure why shellcheck would advise using one >of them over the other, and in particular, why it would advise (( >over let. Maybe it's because of quoting issues with let? Yes. It is because of "quoting issues", but I've never understood what those quoting issues are. It sounds like you are saying that "(( ))" doesn't need its args to be quoted, but "let" does. >It's been my experience that (( looks nicer (because of the aforementioned >quoting issues), but let is *safer* in at least one case. >According to <https://mywiki.wooledge.org/BashPitfalls#pf62>: I can't access that URL - get "Bad Gateway" (in at least two different browsers) > (( hash[$key]++ )) # is not safe > let 'hash[$key]++' # is safe Could you explain what the issue/problem is? What makes it unsafe? And, I really don't like the sound of "It varies by version of bash"...