From my experience with modern programming and scripting languages, I believe most programmers are generally accustomed to referring to the first element of an array as index 0 (zero).
I'm sure I've heard of languages other than zsh
starting array indexing on 1 (one); it's okay, as it is equally convenient.
However, as the previously released and widely used shell scripting languages ksh
and bash
both use 0, why would someone choose to alter this common convention?
There does not seem to be any substantial advantages of using 1 as the first index; then, the only explanation I can think of regarding this somewhat "exclusive feature" to shells would be "they just did this to show off a bit more their cool shell".
I don't know much of either zsh
or its history, though, and there is a high chance my trivial theory about this does not make any sense.
Is there an explanation for this? Or is it just out of personal taste?
csh
, which also used one-based array indexing. – cuonglm Dec 30 '15 at 18:45readlink /bin/sh
– mikeserv Dec 30 '15 at 21:24pacman -S sh
also redirects to bash. They must really hate that poor ol' shell. – deekin Dec 30 '15 at 21:330
like every computer on earth does. (which is probably one of the primary reasons zsh is relegated for use for Live CD installs, etc..) – David C. Rankin Jun 07 '19 at 14:17