批量创建用户

$ cat test26
#!/bin/bash
# process new user accounts
input="users.csv"
while IFS=',' read -r userid name
do
echo "adding $userid"
useradd -c "$name" -m $userid                  #添加备注,并创建指定家目录
done < "$input"
$

cat users.csv
rich,Richard Blum
christine,Christine Bresnahan
barbara,Barbara Blum
tim,Timothy Bresnahan

posted @ 2021-02-14 12:45  玉面-小飞龙  阅读(77)  评论(0)    收藏  举报