LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help require in expect script (https://www.linuxquestions.org/questions/linux-newbie-8/help-require-in-expect-script-4175429384/)

ghoshdastidar1980 09-27-2012 11:46 PM

Help require in expect script
 
2 Attachment(s)
Hi,
I have prepared two script ,[please find the attachment]
1.mypass_root.sh --- shell
2.passwd_root.expect ---- expect

1.mypass_root-->This will take the input from the user & calling the second script. I am passing the shell variable through "PUTS" in expect script.

problem is whenever i am running the scripts it is showing the o/p (mentioned in red) whatever it is taking from the 1st script.

$ ./mypass_root.sh
Enter your Lan id:testuser
Enter your Lan id password
Enter the current password of root:
Enter the account name for which you want to change the password:
enter the newpassword
testuser
testuser
XUdKfZn7
testuser
test


I am able to understand that these o/p are showing because of the following lines in the 2nd scripts
puts $env(lanid)
puts $env(lanpass)
puts $env(rootpass)
puts $env(accname)
puts $env(accpass)

But not able to hide it.Please let me know if you can help me to hide it. I have attached the two scripts.

Red_Man 09-28-2012 05:41 PM

Try to put '-s' switch right after read.

read -s lanpas <- example

Hope it helps


All times are GMT -5. The time now is 03:59 AM.