LittleGreenCat

LittleGreenCat / Show array length in bash

Last active 2 months ago

Like 0

Показать в bash длину массива

LittleGreenCat revised this gist 1 year ago · 42be97e

2 files changed, 10 insertions

array.sh (file created)
@@ -0,0 +1,5 @@
1 + echo $#<array>[@]
2 +
3 + # или если совсем правильно
4 +
5 + echo ${#arrayname[@]}
example.sh (file created)
@@ -0,0 +1,5 @@
1 + --> ARRAY=("one" "two" "three")
2 + --> echo $ARRAY
3 + one two three
4 + --> echo $#ARRAY[@]
5 + 3