#!/bin/bash # Tested & Created in CentOS ENVARRAY=( dev qa prd ) ENV=${#ENVARRAY[*]} i=0 while [ $i -lt $ENV ]; do echo "${ENVARRAY[$i]}" let i++ done # Output will be # dev # qa # prd