Is there a concise way of testing for array support by the local shell at command line ?
This is always possible:
$ arr=(0 1 2 3);if [ "${arr[2]}" != 2 ];then echo "No array support";fi
or testing for $SHELL and shell version:
$ eval $(echo "$SHELL --version") | grep version
and then reading the man page, assuming I have access to it. (Even there, writing from bin/bash, I am assuming that all shells admit the long option --version, when that breaks for ksh for instance.)
I am looking for a simple test that could be unattended and incorporated in a Usage: section at beginning of script or even before calling it.