I have a password reset expect script which stores all the op to an file. I need to check the whether password is successfully changed by greping out the file and storing the o/p to a variable.
But we try to print the variable , its shows only the command instead of its o/p.
First, i do not understand what you need the "exec"s for. In fact
exec command
inside a script should make that script terminate at this point, running "command" in its place instead. This, it seems to me, is hardly what you want.
Second, i have no idea what this is does:
set out "grep -i 'password changed' /tmp/passwd_reset_out$login | wc -l"
But it definitely won't do what it is supposed to. If you want a process substitution to take place - that is, execute a command and assign the output of it to a variable - do it this way:
variable=$(command | command | [...])
Furthermore:
grep 'search' /path/to/file | wc -l
is a useless use of a pipeline and the wc utility. Use
Thanks for the reply. Sorry i should have been more specific.
This is an expect script which internally calls another expect script to reset password on multiple servers by passing userid , oldpass , server name and newpassword.