Bash объявляет проблему с несвязанной переменной массива

declare -a arr=()

find $fullfolder -type f |
while read fullfile
do
    filename=$(basename "$fullfile")
    ext=$([[ $filename = *.* ]] && printf %s ${filename##*.} || printf 'NONE')
    arr+=($ext)
    echo ${#arr[@]}
done
echo ${#arr[@]}

почему ${#arr[@]} в цикле for дает правильные результаты, а внешний - нет?

0 ответов

Другие вопросы по тегам