All pastes #60428 Raw Edit

while_and_array

public shellscript v1 · immutable
#60428 ·published 2006-05-31 22:17 UTC
rendered paste body
declare -a geoInfo # declare an arraycat /tmp/loc.txt |while read line; do   geoInfo[${#geoInfo[@]}]="${line}"  # set new element to ${line}  echo "(${line})" # confirms ${line} is as expected. fine.doneecho "${geoInfo[0]}" # blank. Why?echo "${geoInfo[1]}" # blank. Why?