Você precisa inicializar o valor de retorno para uma variável temporária. então assim:
./my_expect_script.expect
a=$?
if [ $a -eq 0 ]; then
echo -e "\n"
echo "Password successfully changed on $host by $user"
elif [ $a -eq 1 ]; then
echo "Failure, password unchanged"
elif [ $a -eq 2 ]; then
echo "Failure, new and old passwords are too similar"
elif [ $a -eq 3 ]; then
echo "Failure, password must be longer"
else
echo "Password failed to change on $host"
fi