#!/bin/sh
sum=0
for i in $( cat /etc/passwd | cut -d ":" -f3);do
sum=$[$sum+$i]
done
echo "sum of user id:$sum"
shell脚本练习(计算所有用户id之和)
最新推荐文章于 2024-04-10 20:57:52 发布
#!/bin/sh
sum=0
for i in $( cat /etc/passwd | cut -d ":" -f3);do
sum=$[$sum+$i]
done
echo "sum of user id:$sum"