Re: User inputs at one shot
From: Dana French (dfrench_at_mtxia.com)
Date: 07/15/04
- Next message: Faeandar: "Re: I have an inode...."
- Previous message: Perry Whelan: "Re: syntax error: operand expected (error token is " ")"
- In reply to: qazmlp: "User inputs at one shot"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Faeandar: "Re: I have an inode...."
- Previous message: Perry Whelan: "Re: syntax error: operand expected (error token is " ")"
- In reply to: qazmlp: "User inputs at one shot"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|