标签:log shel type int cal 关联 one oca etc
#!/bin/bash
declare -A shells (定义关联数组shells)
while read ll (读取/etc/passwd,ll为变量)
do
type=`echo $ll | awk -F: ‘{print $7}‘` (type为变量,切割ll后的变量)
let shells[$type]++
done < /etc/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
标签:log shel type int cal 关联 one oca etc
原文地址:https://www.cnblogs.com/zjz20/p/11351573.html