Answers for "get length of array bash"

3

get length of array bash

## define it
distro=("redhat" "debian" "gentoo")
 
## get length of $distro array
len=${#distro[@]}
 
## Use bash for loop 
for (( i=0; i<$len; i++ )); do echo "${distro[$i]}" ; done
Posted by: Guest on June-27-2020
0

bash size of array

echo "${#my_array[@]}"
Posted by: Guest on February-26-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language