Tuesday, May 12, 2009

[zz][Shell script] 讓/etc/passwd更利於閱讀

不錯,很好用
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/bash
IFS=:
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:

 
 

No comments: