如果uid> 1000 userdel uid 否则 退出
答案 0 :(得分:0)
例如
perl -F: -lanE 'say $F[0] if $F[2] > 1000' /etc/passwd | xargs -n1 echo userdel -r
或
awk -F':' '$3 > 1000 {print $1}' /etc/passwd | xargs -n1 echo userdel -r
答案 1 :(得分:-1)
while IFS=":" read -r user x uid x; do [[ $uid -gt 1000 ]] && echo userdel -r "$user"; done </etc/passwd
如果每件事看起来都不错,请删除echo
。