编写 shell 程序,实现自动删除 50 个账号的功能。账号名为 stu1 至 stu50
#!/bin/bash
for i in {1..50}
do
userdel -r stu0${i}//注意此处容易出错写成stu0{$i}
done
或者
#!/bin/sh
i=1
while [ $i -le 50 ]
do
userdel stu${i}
i=$(($i+1 ))
done本文出自 “ItGeShen” 博客,转载请与作者联系!
原文:http://itgeshen.blog.51cto.com/11646497/1913780