Auto input with echo

Thread Tools Search this Thread
# 1  
Auto input with echo

in cygwin, cron-config will ask two inputs: yes or no.

1st question, answer is no
2nd question, answer is yes

my script:

echo no | cron-config

how do i pass yes to 2nd question ?
# 2  
Try a here document
cron-config <<EOF

The bottom EOF pair ( could be any series of characters that are meaningless to the shell) has to be in column 1 -- leftmost column
# 3  
cool. thanks. worked perfectly!
# 4  
You could also try
$ { echo yes; echo no; } | cron-config

, or, depending on your system/shell,
$ echo -e "yes\nno" | cron-config

# 5  
printf "%s\n" no yes | cron-config


Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Auto input to fetch cluster manager details

Team, Presently i am trying to do basic checks on my my-sql cluster boxes. The command ndb_mgm checks for the cluster environment details by typing the show command, and exit to come out of the ndb_mgm command. Rather, than typing i have made a script with the below contents in the... (4 Replies)
Discussion started by: whizkidash
4 Replies

2. Shell Programming and Scripting

How to read each line from input file, assign variables, and echo to output file?

I've got a file that looks like this (spaces before first entries intentional): 12345650-000005000GL140227 ANNUAL HELC FEE EN 22345650-000005000GL140227 ANNUAL HELC FEE EN 32345650-000005000GL140227 ANNUAL HELC FEE EN I want to read through the file line by line,... (6 Replies)
Discussion started by: Scottie1954
6 Replies

3. Shell Programming and Scripting

accept input on an echo output

echo (some info) read? <&1(not working for me) (1 Reply)
Discussion started by: robin_simple
1 Replies

4. Shell Programming and Scripting

Echo date variable from data input to a script

Hi, I'm trying to make a script which you type the year, select the month and day and then create the date in the format 2010-12-7. #!/bin/bash dia () { echo " Seleccione el dia:" select file in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Salir do... (6 Replies)
Discussion started by: iga3725
6 Replies

5. Shell Programming and Scripting

Putting echo output as input to stat

I have a string with escape differentiators as a result of searching for a file using find. Essentially find returned to my shell variable several absolute paths each ending with the file name and each path/file separated by \n. Echo recognizes the escape sequence and is able to print the paths... (3 Replies)
Discussion started by: Ebodee
3 Replies

6. UNIX for Dummies Questions & Answers

How to correctly use an echo inside an echo?

Bit of a weird one i suppose, i want to use an echo inside an echo... For example... i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos... echo "echo "hello"" >$file echo "echo "goodbye"" >$file ... (3 Replies)
Discussion started by: mokachoka
3 Replies

7. Shell Programming and Scripting

problem piping input to script with echo

I am trying to have a script run without interaction from the command line. So in my script i have a line like this echo -e "\n\n\ny\ny\n" | ./script the goal being the ability to mimic 3 Enter presses and 2 'y/n' responses with 'y' followed by enter. For some reason tho, it is not... (1 Reply)
Discussion started by: mcdef
1 Replies

8. Shell Programming and Scripting

usage of echo with standard input

Hi, I am passing the file filename to a program and I have to use the "<" sign: program < filename Inside the program I would like to assign the string "filename" to a variable var. I can't do that with "var=$(echo $1)" because of the "<" sign. Removing the "<" sign would work for echo,... (13 Replies)
Discussion started by: calandrea
13 Replies

9. Shell Programming and Scripting

suppress echo while reading input in expect

Hi all, I tried searching for similar threads. Couldn't get any for Expect scripting. I am trying automate a task which requires login to a machine. The user would be prompted for the password. Now, I want this input to be hidden from being displayed on the screen. Is there... (1 Reply)
Discussion started by: sudhir_onweb
1 Replies

Featured Tech Videos