shell脚本打印/etc/passwd

@努力的小王  March 28, 2018
#!/bin/env bash
while read she
do 
       user=`echo $she |awk -F":""/" '{print $1}{print $2}{print $3}'`
       username[++I]=$user
done < /etc/passwd

echo "username first: ${username[1]}"

for z in ${!username[@]}
do
         echo "$z: ${username[z]}"
done
echo -e "\033[47;30m any OK Success.....\033[0m"

2.效果
27: oprofile:x:16:16:Special user account to be used by OProfile
home/oprofile
sbin/nologin


添加新评论