Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-28-2012, 12:46 AM   #1
LQ Newbie
Registered: Mar 2010
Posts: 9

Rep: Reputation: 0
Help require in expect script

I have prepared two script ,[please find the attachment] --- 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.

$ ./
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

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.
Attached Files
File Type: txt passwd_root.expect.txt (281 Bytes, 19 views)
File Type: txt myshell.txt (494 Bytes, 10 views)
Old 09-28-2012, 06:41 PM   #2
LQ Newbie
Registered: Nov 2007
Location: Dallas, TX
Distribution: RHEL, CentOS, Fedora
Posts: 16

Rep: Reputation: 0
Try to put '-s' switch right after read.

read -s lanpas <- example

Hope it helps


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 10:06 PM
[SOLVED] Problem in exporting variable from bash script to expect script uk.engr Linux - Newbie 3 06-14-2012 02:57 AM
Issue in running commands in expect script from shell script yadvinder Programming 0 05-31-2012 05:07 AM
[SOLVED] /usr/bin/expect : Script to check server load using both expect and bash Soji Antony Programming 1 07-28-2010 12:27 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration