Re: User inputs at one shot

From: Dana French (dfrench_at_mtxia.com)
Date: 07/15/04


Date: 15 Jul 2004 13:02:16 -0700

qazmlp1209@rediffmail.com (qazmlp) wrote in message news:<db9bbf31.0407140915.29e02101@posting.google.com>...
> What approach is normally followed in shell scripts(preferably with
> ksh), where the pre-determined user inputs need to be given frequently
> during the script execution?
>
> The script will look something like this:
> -------------
> do something
> prompt for user input
> do something2 based on the user input
> prompt for user input again
> do something3 based on the user input
> prompt for user input again
> -------------
>
> Basically, the script has to be run without any user prompts in
> between(as the user inputs are pre-determined ones already).
>
> How exactly this can be achieved?

You could also use a "Here Document" that allows you to imbed your
responses into your script such as:

some_command <<ENDOFRESPONSES
resonse to question 1
response to question 2
response to question 3
response to question 4
ENDOFRESPONSES

The "word" you use to delimit your responses is configurable and does
not have to be "ENDOFRESPONSES", however you must preceed it with a
"<<".

Also if you quote the "word" in any way (single quotes, double quotes,
or a backslash) variables within the "Here Document" will not be
interpreted.

Dana French



Relevant Pages

  • Re: State of Forth 200x
    ... user input *is* source code. ... The script is essentially one-time user input. ... The dialect I use is a concatenative language with flow control, ... the command language is the full compiled language, ...
    (comp.lang.forth)
  • Re: trouble with a script
    ... The user input would be "domain.com", ... Basically, I want my script to prompt me for two inputs, then append to ... have tried many ways to write a newline character in the script, ... Shell Scripting Recipes: ...
    (comp.unix.shell)
  • Re: Securing an Email script
    ... The main issue I'm wondering about is if I control the to and from address and header information for the mail, as I do above, is it possible to inject something else into the email to hijack the mail server? ... Well, you're placing anything in the header which comes from the user, so in that respect your script is safe. ... However, just to be safe, you should verify the data input by the user. ... > 1) the script is safe because no user input is used in the header. ...
    (comp.lang.php)
  • Re: A script for accepting defaults
    ... the installation script from this file. ... explicitly enumerated user input, ... which will interpose itself before the read builtin command, ...
    (comp.unix.shell)
  • Re: Passing Variables from One Perlscript to Another
    ... The first HTML page has a form which requests for user input. ... The Perl script will then validate the data. ... > validation passes, it display the user input and asks for confirmation. ...
    (comp.lang.perl.misc)