Open mined opened 1 year ago
Seems like bash does arithmetic expansion when indexing arrays, so no need for $
. Works in zsh and probably other shells too.
$ declare -a myarr
$ myarr=(imageA imageB imageC imageD)
$ echo "${myarr[$RANDOM % ${#myarr[@]}]}"
imageA
$ echo "${myarr[RANDOM % ${#myarr[@]}]}"
imageD
I see the line
Should that be
$RANDOM
?