3 ms·
A couple of weeks ago I learnt that Bash on Mac does not have associative arrays. We worked around the issue by changing the script to run under Zsh, but beware
by oniony 2y ago
A couple of weeks ago I learnt that Bash on Mac does not have associative arrays. We worked around the issue by changing the script to run under Zsh, but beware.
- ptdorf 2y agoSounds like a bash 3 issue. $ bash --version GNU bash, version 5.2.32(1)-release (aarch64-apple-darwin23.4.0) $ declare -A aaa; aaa[a]=a; aaa[b]=bb; for i in ${!aaa[@]}; do echo "$i --> ${aaa[$i]}"; done b --> bb a --> a
- forgotpwd16 2y agoTo elaborate on this, macOS default bash is still stuck (assuming due to licensing) in v3.2.x (released in 2007). Bash got associative arrays in v4 (released in 2009).
- x3n0ph3n3 2y agoYou should be getting bash from homebrew anyways.
- pletnes 2y agoJust use the included zsh.
- tgv 2y agoI like my scripts to run on both linux and macos. It's somewhat limiting, but it saves trouble.
- eadmund 2y agoOr using an OS which doesn’t ship ancient software. Linux exists. It’s pretty awesome.
- wruza 2y agoOnly until you find that your requirement or use case doesn’t work in it.
- tgv 2y agoThere's a time and place for evangelism. This isn't it.
- x3n0ph3n3 2y agoWhen they make a decent laptop for linux, maybe I'll switch. I wanted so badly to move to System76, but their screens are awful.
- oniony 2y agoMy employer does not let me install Linux on my Mac.
- teddyh 2y agoMany programs on macOS are stuck in the ancient past, due to Apple: <https://web.archive.org/web/20240810094701/https://meta.ath0.com/2012/02/05/apples-great-gpl-purge/ https://web.archive.org/web/20240810094701/https://meta.ath0...>