Category Archives: Blech

This is the default catagory and should be avoided. If there is something in this catagory it means either it should be catagorized into one of the other catagories or there needs to be a new catagory created to encompass the post in question.

HowTo: Copy an Array in bash

If you want to make a copy of an array as an array in bash, you must use this specific syntax in order to get the elements parsed as individual elements.

##

export -a "$newArray=(${oldArray[*]})"

#

The asterisk gives access to each element within the original array, and the parentheses ensure the new array is populated also as an array with multiple elements.

Share