I'm new to bash and can't find a good tutorial to answer my question.array=( item1 item2 item3)for name in ${array[@]}; do    echo current/total    ... some other codesdoneI want to calculate the current and total value, as the expected output of this being:1/32/33/3Thanks for any kind of tips
how to count the length of an array defined in bash?
bash;array
You can access the array index using ${!array[@]} and the length of the array using ${#array[@]} e.g.#!/bin/basharray=( item1 item2 item3 )for index in ${!array[@]}; do    echo $index/${#array[@]}doneNote that since bash arrays are zero indexed, you will actually get0/31/32/3If you want the count to run from 1 you can replace $index by $((index+1)). If you want the values as well as the indices you can use ${array[index]} i.e.#!/bin/basharray=( item1 item2 item3 )for index in ${!array[@]}; do    echo $((index+1))/${#array[@]} = ${array[index]}donegiving1/3 = item12/3 = item23/3 = item3