I should clarify, I am not looking for a timeout, as the program halts until an actual user enters something into the command window during execution. I am looking for the script to issue what a physical person needs to do when it prompts with the screen

 "Do you want to read the file? 1 for yes, 2 for no. (Default is 2)"

in this case, if someone was physically at the computer during execution and they wanted to read the file, they would type "1" and hit enter. That is what I am looking to have my script do automatically. I looked into expect, and their are two primary issues with it unfortunately.

One is it appears to depend on using files and I am not using any files, perhaps I am incorrect on this?

Two, I am developing this for a company where I can't put this on our systems without waiting past a time where the deadline for the larger piece of code that this script is associated with.

Edit: I have decided to retrieve Expect for my local system at least and begin the process of making point two of this post moot. Hopefully Expect will be able accomplish what I need.


In reply to Re^2: automatically giving user input to a command line by tfredett
in thread automatically giving user input to a command line by tfredett

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.