shell script needed to reset the password on multiple unix flavour
I need ur help and suggestion to make my code efficient.I have to reset the password for multiple unix flavour using expect tool.There is one file in which I have mentioned ip address and main script will pickup those ip and reset all password and it will write to a log file whether it has been succeded or not.
#!/bin/bash username="research" echo -n "Enter your password:" read -s newPassword cat ssh.csv | while read line; do host=`echo $line | cut -d, -f1` addr=`echo $line | cut -d, -f2` paswd=`echo $line | cut -d, -f3` echo "$host,$addr,$paswd" cct=$(./logext.exp $paswd $newPassword $addr $username) if [[ "$cct" == *login* ]]; then echo "SSH Connection to $host succeeded" >> testlog if [[ "$cct" == *successfully* ]]; then echo "Password has been changed successfully for $host" >> testlog else echo "Password change failed for $host." >> testlog echo "$host,$addr,$paswd" >> errorlog fi else [[ "$cct" == *Permission* ]] echo "$host,$addr,$paswd" >> errorlog fi cct="" done