http://go-linux.blogspot.com/2009/05/shell-script-etcpasswd.html
Sent to you by iveney via Google Reader:
via 瘋狂帽客's Blog by 瘋狂帽客 on 5/12/09
#!/bin/bashIFS=:
echo "System User list:"
echo "-------------------------------------"
while read username shapass uid gid comm home shell
do
echo "UserName:$username"
echo " 1.password:$shapass"
echo " 2.uid:$uid"
echo " 3.gid:$gid"
echo " 4.comment:$comm"
echo " 5.home:$home"
echo " 6.default shell:$shell"
echo "------------------------------------"
done < /etc/passwd
參考Linux-101 Hacks, hack 88. Read data file fields inside a shell script
Things you can do from here:
- Subscribe to 瘋狂帽客's Blog using Google Reader
- Get started using Google Reader to easily keep up with all your favorite sites
No comments:
Post a Comment