! # / bin / the bash
DECLARE -A shells (defined in associative array shells)
the while Read LL (reading / etc / passwd, ll variable)
do
type = `$ echo LL | awk -F: '{}. 7 Print $'` (type of a variable, the cut LL)
the let shells [$ type] ++
DONE </ etc / the passwd
for I in $ {! shells [@]}
do
echo "$ I $ ::::: shells {[ I $]} "
DONE
~
[root@localhost ~]# bash tj2.sh
/sbin/nologin ::::: 17
/bin/sync ::::: 1
/bin/bash ::::: 3
/sbin/shutdown ::::: 1
/sbin/halt ::::: 1