Hi Team,
I am using shell script to add user and update password automatically.Below is my shell script.
#!/usr/bin/expect
set timeout 120
useradd rock
spawn passwd rock
expect {
“Enter new UNIX password:” { send “rock@123\r” }
}
expect eof
When i run that script its throwing an error.
[root@WEBPORTALSEA ~]# ./user.sh
invalid command name “useradd”
while executing "useradd rock"
(file "./user.sh" line 3)
Please let us know how to resolve. I am using RHEL 6.8 Version