Arrays seem like a fairly fundamental programming feature, so I'm curious why the POSIX shell specification doesn't provide them. Are there historical or design reasons behind this choice, beyond simple oversight?
3 Answers
The main reason is historical compatibility. POSIX was intended to standardize behavior that existing Unix systems and shells already provided, rather than design a completely new shell language. The Bourne shell, which forms the basis of the standardized `sh` language, didn’t have an array type, so arrays weren’t included.
POSIX shell is deliberately fairly minimal and is centered around launching programs, managing files, expanding text, and connecting commands through pipes. It treats command arguments and streams as the main ways to handle collections of data. Adding arrays would have made the language more complex and could have created compatibility problems across older implementations.
Arrays are useful in plenty of automation tasks, so it isn’t that shells have no use for them. They’re simply non-standard extensions: shells such as Bash and KornShell provide array features, but scripts that require strict POSIX `sh` compatibility can’t rely on them. Portable scripts commonly use positional parameters, newline-delimited data, or external tools instead.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically