shellで複数のユーザを追加する方法

shellコード:
#!/bin/bash
#useradd andpassword
echo “please input username:"
read name
echo “please input number:"
read num
n=1
while [ $n -le $num ]
do
useradd $name$n
n=`expr $n + 1 `
done
#/etc/shasow info
echo “please input passwd"
read passwd
m=1
while [ $m -le $num ]
do
echo $passwd |passwd –stdin $name$m >/dev/null
m=`expr $m + 1 `
done

shellscript

Posted by arkgame