shell脚本练习(计算所有用户id之和)

#!/bin/sh

sum=0

for i in $( cat /etc/passwd | cut -d ":" -f3);do
  sum=$[$sum+$i]
done

echo "sum of user id:$sum"

猜你喜欢

转载自blog.csdn.net/hxpjava1/article/details/80719371