Advertisement

06.28.2008 at 01:46PM PDT, ID: 23524311
[x]
Attachment Details

redirecting standard input in unix

Asked by gghaleb in KornShell (ksh), Unix Operating Systems

Tags: ksh, Unix, K-shell, KSH

I have a KSH script in unix which requires the user to enter some responses (Y or N) at certain intervals of the code. I would like to automate this KSH script by redirecting the standard input.

I would like to create a text file (INPUT.TXT) which contains all the inputs.
So the file will have a list of Y and N in newlines. for example, the file INPUT.TXT will look as follows:

Y
Y
Y
Y
Y

However, I do not know how many times the code asks for inputs. So my question what if the KSH script only requires 4 Y responses and I put 6 Y responses in INPUT.TXT. will this have any effect? or will the 4 Ys be input into the script and the script will complete succesfully.

Also will this allow me to issue a nohup session on the KSH script?
for example

nohup MyScript.ksh < INPUT.TXT &

ThanksStart Free Trial
[+][-]06.28.2008 at 01:51PM PDT, ID: 21892006

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.28.2008 at 02:01PM PDT, ID: 21892031

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.28.2008 at 02:04PM PDT, ID: 21892037

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.28.2008 at 02:13PM PDT, ID: 21892052

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.28.2008 at 02:23PM PDT, ID: 21892075

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.28.2008 at 04:48PM PDT, ID: 21892410

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: KornShell (ksh), Unix Operating Systems
Tags: ksh, Unix, K-shell, KSH
Sign Up Now!
Solution Provided By: Tintin
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.24.2008 at 05:14PM PDT, ID: 22084944

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628