• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

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

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.
1 Solution
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"

waugerAuthor Commented:
Hey that did it. Your right! Thanks for your help.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now