Shell script answer prompts?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script answer prompts?
# 1  
Old 08-03-2007
Shell script answer prompts?

Hi,

I'm writing a script that calls a function to generate a certificate. In generating this certificate, I'm asked a series of questions. I was wondering, is there a way to pre-program my script to answer these questions in the same way all the time. I saw something like

Code:
EOF>>
y
EOF

Assuming y is the answer I want. If I get like 5 questions and I want answers other than y for each question, how would that work? Thanks!

Elt
# 2  
Old 08-03-2007
Have you tried piping the answers:
Code:
echo 'Ans1\nAns2\nAns3" | your_sript

# 3  
Old 08-03-2007
Quote:
Originally Posted by Shell_Life
Have you tried piping the answers:
Code:
echo 'Ans1\nAns2\nAns3" | your_sript

Actually, the interactive question is not generated from a script I wrote. It's a java tool which ask me questions to create a certificate based on it. I guess my solution probably lies in trying to be able to program my script to answer these interactive questions which I'm not exactly sure how to do
# 4  
Old 08-03-2007
Never mind, I actually got it to work using the:

Code:
command << EOF
answer
EOF

Thanks anyways
This User Gave Thanks to eltinator For This Post:
# 5  
Old 08-29-2007
Quote:
Originally Posted by Shell_Life
Have you tried piping the answers:
Code:
echo 'Ans1\nAns2\nAns3" | your_sript


Hello,

can you please tell me how to send "enter" as part of answers in the above trick!!
say here Ans1 = Ans2 = Y and Ans3 being the "enter"

-ilan
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sqlldr call via shell script prompts error

Good morning, I'm attempting to call sqlldr via shell script and it is prompting endIf is unec #!/bin/sh cd /tmp/v_tst FILENAME_WANTED=`date +"HourlyData_%Y%m%d_%H00.txt"` echo "FILENAME_WANTED = ${FILENAME_WANTED}" LIST_OF_FILES=`ls -rt HourlyData*.txt |tail -1` LIST_OF_FILES=`basename... (4 Replies)
Discussion started by: V1l1h1
4 Replies

2. Shell Programming and Scripting

Need some help in formatting answer of shell script

Dear all, I am new to shell scripting and have tried to make a small program for fun sake that tells age from the last number of cell phone and birth year. At the end we get a final 3 digit number and the first digit represents the last digit of cell phone and rest 2 numbers shows age. eg. 423... (4 Replies)
Discussion started by: stg44
4 Replies

3. Shell Programming and Scripting

Bash script to start program and answer prompts?

I'm trying to write a script the simplifies the execution of a program: After starting the program (sh ~/.mfix/model/make_mfix) I am prompted four times for options: Do you need SMP version? (y/n) Do you need DMP version? (y/n) Do you need debug version? (y/n) Force re-compilation of... (2 Replies)
Discussion started by: lanew
2 Replies

4. Shell Programming and Scripting

perl Rover script - anticipating prompts

At work I use this rover script to perform ID administration of machines that have no central management system. The one problem I encounter is the prompt of the machine I'm trying to reach. For instance, by default rover looks for $, which most *nix prompts do end with a $, and tries to... (0 Replies)
Discussion started by: MaindotC
0 Replies

5. Shell Programming and Scripting

script prompts the user to enter four lines.

The script prompts the user to enter four lines. (1 Reply)
Discussion started by: polineni
1 Replies

6. Shell Programming and Scripting

Answer Terminal Questions With Shell Script?

First off, I am using Mac OS X, with Apple Remote Desktop. I have to install several app's on teachers' laptops which are on several cd's that I have made disk images of. (DMG's) To do rollouts quicker, I have written a script to mount the disk images and running the installers inside each of... (4 Replies)
Discussion started by: The Reepr
4 Replies

7. Shell Programming and Scripting

shell script that adds two integers and display answer on screen

please help shell script that adds two intergers and display answer on screen (1 Reply)
Discussion started by: wanyac2
1 Replies

8. Shell Programming and Scripting

Shell Program that prompts for user Id

Hi I have a question that after trying tirelessly I cant solve. I'm not great wth UNIX and wonder if anyone could help. I have to create a shell program using functions that prompts for a user ID. I must then verify that the user Id corresponds to an account on the system. If a legal user Id is... (16 Replies)
Discussion started by: mmg2711
16 Replies

9. UNIX for Dummies Questions & Answers

Shell Program that prompts for user Id

Hi I have a question that after trying tirelessly I cant solve. I'm not great wth UNIX and wonder if anyone could help. I have to create a shell program using functions that prompts for a user ID. I must then verify that the user Id corresponds to an account on the system. If a legal user Id is... (1 Reply)
Discussion started by: mmg2711
1 Replies

10. Shell Programming and Scripting

script providing input to application prompts

Hi! I want to write a script that will create an archive (via tar) that will restrict the size of the tar file. The size can be constrained using the keyword 'k' and providing the size restriction. The problem is that the script needs to know (detect) when the tar command prompts the user (which... (2 Replies)
Discussion started by: mitch8
2 Replies
Login or Register to Ask a Question