3 ms·
At least you've discovered Zsh and hopefully its significant improvements over Bash. The only Bash benefit is readarray/mapfile, Z Shell is better in just about
by nerdponx 3y ago
At least you've discovered Zsh and hopefully its significant improvements over Bash. The only Bash benefit is readarray/mapfile, Z Shell is better in just about every other way.
- JNRowe 3y agoUnless I'm misreading your comment, zsh does provide similar functionality via zsh/mapfile¹. It, and a lot of other cool stuff, is documented in zshmodules(1). ¹ https://zsh.sourceforge.io/Doc/Release/Zsh-Modules.html#The-zsh_002fmapfile-Module https://zsh.sourceforge.io/Doc/Release/Zsh-Modules.html#The-...
- nerdponx 3y agoI believe Bash readarray/mapfile is more like doing this in Zsh: lines=( "${(@f)$(my_command)}" ) or lines=( "${(@f)$(<my_file)}" ) which IMO is a little less nice than using a builtin with a name like "readarray". But this is cool too.