【就业班作业】【第四周】查出用户UID最大值的用户名、UID及shell类型
第一步:先在/etc/passwd/查出用户名、UID及shell类型;
cat /etc/passwd | cut -d: -f1,3,7
第二步:根据查出的第2例进行sort排序:-t:以冒号为分隔,-k 2以第2列为基准,-n 以数值从小到大排序
cat /etc/passwd | cut -d: -f1,3,7 | sort -t: -k2 -n
第三步:tail -n 1 取出最后1条记录,即为:用户UID最大值的用户名、UID及shell类型
cat /etc/passwd | cut -d: -f1,3,7 | sort -t: -k2 -n | tail -n 1
(结束)