Closed oceanMIH closed 1 year ago
You can recreate array:
arr2=("${arr[@]}")
You can recreate array:
arr2=("${arr[@]}")
yes, thanx I think the following is better: for i in ${!arr[@]}; do printf '%s\n' "${arr[i]}" done
Also should work without loop:
printf '%s\n' "${arr[@]}"
for ((i=0;i<${#arr[@]};i++)); do printf '%s\n' "${arr[i]}" done
the above code may be wrong if the array is not contiuous, or there are holes in the array for example: arr=(apple [3]=banana [6]=cherry)