I have something in bash like
bash
myArray=(\'red\' \'orange\' \'green\')
And I would like to do something like
echo ${
A little more concise and works in Bash 3.x:
my_array=(red orange green) value='green' for i in "${!my_array[@]}"; do [[ "${my_array[$i]}" = "${value}" ]] && break done echo $i