/bin/sh dificilmente é um Bourne shell em qualquer sistema atualmente (mesmo o Solaris, que foi um dos últimos grandes sistemas a incluir, agora mudou para um POSIX sh para seu / bin / sh no Solaris 11). /bin/sh foi a casca de Thompson no início dos anos 70. O shell Bourne o substituiu no Unix V7 em 1979.
/bin/sh tem sido o shell Bourne por muitos anos depois (ou o shell Almquist, uma reimplementação gratuita em BSDs).
Hoje em dia, /bin/sh é mais comumente um intérprete ou outro para a linguagem POSIX sh que é baseada em um subconjunto da linguagem do ksh88 (e um superconjunto da linguagem shell Bourne com algumas incompatibilidades).
O shell Bourne ou a especificação da linguagem POSIX sh não suportam matrizes. Ou melhor, eles têm apenas um array: os parâmetros posicionais ( $1 , $2 , $@ , então um array por função também).
O ksh88 tem matrizes que você define com set -A , mas que não foram especificadas no POSIX sh, pois a sintaxe é inábil e pouco útil.
Outros shells com variáveis de matriz / lista incluem: csh / tcsh , rc , es , bash (que copiou principalmente a sintaxe ksh da forma ksh93), yash , zsh , fish cada com uma sintaxe diferente ( rc o shell do sucessor do Unix, fish e zsh sendo os mais consistentes) ...
No padrão sh (também funciona nas versões modernas do shell Bourne):
set '1st element' 2 3 # setting the array
set -- "$@" more # adding elements to the end of the array
shift 2 # removing elements (here 2) from the beginning of the array
printf '<%s>\n' "$@" # passing all the elements of the $@ array
# as arguments to a command
for i do # looping over the elements of the $@ array ($1, $2...)
printf 'Looping over "%s"\n' "$i"
done
printf '%s\n' "$1" # accessing individual element of the array.
# up to the 9th only with the Bourne shell though
# (only the Bourne shell), and note that you need
# the braces (as in "${10}") past the 9th in other
# shells.
printf '%s\n' "$# elements in the array"
printf '%s\n' "$*" # join the elements of the array with the
# first character (byte in some implementations)
# of $IFS (not in the Bourne shell where it's on
# space instead regardless of the value of $IFS)
(observe que no shell Bourne e no ksh88, $IFS deve conter o caractere de espaço para que "$@" funcione corretamente (um bug) e, no shell Bourne, não é possível acessar elementos acima de $9 ( ${10} não funciona, você ainda pode fazer shift 1; echo "$9" ou passar por cima deles)).