I have this script
tests=()
igrepy -l $1 . | while read -r line
do
    // some processing
    tests+=("${second[0]}")
done
echo ${tests[@]}
I've checked that 'second' has a result and it does, however my echo returns a blank string. What has gone wrong here? This is on rhel6, 'igrepy' is an alias to a case insensitive grep that only search python files
do(eg awhileor similar).@must be quoted for it to work as it should. So your last line should have beenecho "${tests[@]}". But that won't solve the underlying issue - see the answers from the duplicate questions for that.