Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
Source by www.cyberciti.biz #
 
PREVIOUS NEXT
Tagged: #length #array #bash
ADD COMMENT
Topic
Name
1+2 =