Answers for "get array length 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

javascript set max length of string

String.prototype.trimEllip = function (length) {
  return this.length > length ? this.substring(0, length) + "..." : this;
}
Posted by: Guest on January-06-2020
0

bash size of array

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

Code answers related to "Javascript"

Browse Popular Code Answers by Language