#!/usr/bin/expect

set IP [lindex $argv 0]

set PASS [lindex $argv 1]

spawn ssh root@$IP useradd dingdangmao -p 'westos'

expect{

    yes/no

    {send "yes\r";exp_continue}

    "password:"

     {send "$PASS\r"}

}

interact



#!/usr/bin

for x in {248..249}

do

ping -c1 -w1 172.25.254.$x &> /dev/null && ( /mnt/check_user.exp) 172.25.254.$x redhat) ||

(echo 172.25.254.$x is down)

done