标签:linux
1. 循环添加10个用户:
#!/bin/bash
#
for i in {1..10}; do
if id user$i &> /dev/null; then
echo "user$i exists."
else
useradd user$i
echo user$i | passwd --stdin user$i &> /dev/null
echo "add user user$i finished."
fi
done
2. 循环删除10个用户:
#!/bin/bash
#
for I in {1..10}; do
if id user$I &> /dev/null; then
userdel -r user$I
echo "Delete user$I finished."
else
echo "user$I not exist."
done
本文出自 “www.aboboo520.com” 博客,请务必保留此出处http://aboboo520.blog.51cto.com/11330424/1886082
标签:linux
原文地址:http://aboboo520.blog.51cto.com/11330424/1886082