View Issue Details

IDProjectCategoryView StatusLast Update
00019761003.1(2024)/Issue8Shell and Utilitiespublic2026-03-13 21:10
Reporternavi Assigned To 
PrioritynormalSeverityEditorialTypeEnhancement Request
Status NewResolutionOpen 
Namenavi
Organization
User Reference
SectionXCU: 2. Shell Command Language
Page Number--
Line Number--
Interp Status
Final Accepted Text
Summary0001976: specify array variables and syntax
DescriptionPOSIX sh specifies one array per function, the argument array

many sh implementations support having array variables past the argument array

due to posix shell specifying a syntax for the argument array, sh implementations
with array extensions naturally landed on similar and compatible syntax

mksh, ksh93, bash, zsh, osh, yash, all support the following syntax:
    foo=(a b "c d" e)
    foo+=(f g)
    "${foo[@]}" # a b "c d" e f g
    "${foo[*]}" # "a b c d e f g"
    "${foo[expr]}" # indexed by expr, where expr is evaluated like $(( expr ))
    "${#foo[@]}" # 6, the lenght of foo

additionally, mksh, ksh, and zsh, support declaring arrays as such:
    set -A name -- values

notably ksh does not implement the name=(values) syntax, but has no other syntax
that would conflict with it either

ash and dash do not currently implement any sort of arrays, but also have
no syntax that conflicts with the existing extensions
Desired Actionrough first draft of changes:

XBD 4.25:

specify varname=(value) as assigning an array variable
specify varname[expr]=value as assigning a entry in the array

XCU: 2.5:
specify array variables as containing an array of arbitrary byte sequences, except for null byte

XCU: 2.6.2:

specify ${parameter[@]} and ${parameter[*]} expansions matching 2.5.2 special parameters
specify ${parameter[expr]} expansion, where expr is arithimetically expanded, then parameter is expanded matching 2.5.1 positional parameters
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2026-03-13 21:10 navi New Issue