##/bin/bash
password='Aa123456'
for user in $(cat ./user_id)
do
/usr/bin/expect <<Eof
set timeout 10
expect "*#"
spawn /usr/sbin/useradd ${user}
expect "*#"
spawn /usr/bin/passwd ${user}
expect {
"*password:" { send "$password\r"; exp_continue}
"*password:" { send "$password\r"}
}
Eof
done