Q:

how to increment array count in bash?

The awk code below counts the frequency of the occurrence of $1.  I would like the bash equivalent for this code?
a[$1]++}END{for(x in a)print a[x],x

How would I do this with a bash array?

A:

Although there will be bash-oriented and smarter ways, the literal translation of your code will be:
declare -A a                    # you need to explicitly declare an associative array

while read -r x rest; do        # "x" is assigned to the first field ($1) and "rest" to the rest
    ((a[$x]++))                 # increment the count
done

for x in "${!a[@]}"; do         # iterate over the array
    echo "${a[$x]},$x"          # print the result
done

The code above waits for the input via the stdin and you need to feed the input with a redirect or a pipe.

