Skip to main content
7 events
when toggle format what by license comment
May 20, 2022 at 7:12 vote accept Amandasaurus
May 19, 2022 at 16:08 history edited Toby Speight CC BY-SA 4.0
Spellfix
May 18, 2022 at 22:02 comment added Chris Davies @Stéphane thank you for the info. I'm not (yet) a zsh user so my comment could only be definitive about the shells I know. The question is tagged bash so there's nothing wrong in expecting an array type to be present; I thought it was worth clarifying which common shells do/don't support it
May 18, 2022 at 19:43 comment added Stéphane Chazelas @roaima, zsh supported arrays long before bash, that array=(foo bar) is actually from zsh. csh (the first in the late 70s), tcsh, rc, es, yash, fish all support arrays / lists. Shells that don't are the exception. Arrays / lists should be the primary data type in shells (and is in many) as the main thing a shell is meant to do is run commands with their list of arguments. The main reason why POSIX didn't specify arrays for sh is (I believe) because it's based on ksh, and the ksh array design (which bash copied unfortunately) is by far the worst.
May 18, 2022 at 18:44 comment added Charles Duffy @roaima, ...well, sh supports exactly one array in each context, the argument list. To use it here might be something like: set -- as an equivalent to area_args=( ), and set -- -l -a vs areas_args=( -l -a ), then ls "$@" to actually pass them through.
May 18, 2022 at 9:56 comment added Chris Davies Worth clarifying that although bash, ksh and (I think) zsh support arrays, sh (and dash) don't?
May 18, 2022 at 9:33 history answered ctrl-alt-delor CC BY-SA 4.0