写一个脚本,依次向/etc/passwd中的每个用户问好,并且说出对方的ID是什么,如:
Hello, root,your UID is 0.
#!/bin/bash
#这个脚本用来问候用户
#作者:猿课-阿铭 www.apelearn.com
#日期:2018-12-11
cat /etc/passwd |while read line
do
username=`echo $line|awk -F ':' '{print $1}'`
uid=`echo $line|awk -F ':' '{print $3}'`
echo "Hello, $username, your uid is $uid."
done