The code below prints outs each array element, but it always says the array length is 1 even though its not. What am i doing wrong?
function printArray(){
#here should check if it is an array and that an arg exits
echo "Priting array"
myarr="${@}"
echo "Array length is ${#myarr[@]}"
for element in ${myarr[@]} ; do
echo $element
done
}
printArray "${array[@]}"
Thanks