puts -nownewline "string" does not work in Solaris 5.6 Expect 5.28

Posted on 2003-03-05
Medium Priority
Last Modified: 2013-12-27
hi All,
I am trying to write an expect script that will ask a question then read in the user input and assign to var. However the question statement:
puts -nonewline "question" does not work. the script just does not run correctly, it just hangs. I know that I am using the right syntax. In fact if I remove the "-nonewline" switch, the script runs perfectly, expect there is a newline at the end of the question. Any help is appreciated.
Question by:wauger
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

guerriero33t earned 400 total points
ID: 8086846
Could you paste in the lines where you are asking the question and expecting input from the user?

I think your using puts where you should be using gets.

try this

send_user "What is your answer:"
gets stdin variable

the send_user sends the qeustion to the user. Without using \n there will not be a new line. The "gets stdin" will read from the keyboard and store it in the variable named variable. Now you can use $variable throughout your code.

The following will create a newline.
send_user "What is your answer:\n"


Author Comment

ID: 8088058
Hey that did it. Your right! Thanks for your help.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question