bash - shell script “${array[@]}” expansion: first and last entry have extra characters -
i have shell script uses array. script cycle through entries of array reason first , last entry has problem.
the array:
queue_names=( clqueue dlq expiryqueue )
the loop:
for in “${queue_names[@]}” #do stuff done
i can see in console , shows first entry shows: �clqueue. last entry shows: expiryqueue�
i'm guessing these markers know start , end of array. unfortunately interfering functionality of script. use these queue names search , fails find because of added character. how rid of them or there code change avoid problem?
“${queue_names[@]}”
not "${queue_names[@]}"
, because “”
not ""
.
"smart quotes" aren't recognized quotes @ in bash; thus, effect same if expansion had been unquoted -- string-splitting , glob-expansion on array contents -- literal "quotes" grafted around start , end characters.
you need use real quotes -- ""
-- not opening/closing "smart quotes" created word processing software or corporate email tools.