Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

Auto input with echo

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 02-03-2013
lawsongeek lawsongeek is offline
Banned
 
Join Date: Aug 2011
Last Activity: 17 October 2015, 1:15 PM EDT
Posts: 88
Thanks: 4
Thanked 1 Time in 1 Post
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 ?
Sponsored Links
    #2  
Old Unix and Linux 02-03-2013
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 28 July 2016, 10:47 AM EDT
Location: NM
Posts: 10,778
Thanks: 429
Thanked 952 Times in 883 Posts
Try a here document

Code:
cron-config <<EOF
no
yes
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
Sponsored Links
    #3  
Old Unix and Linux 02-03-2013
lawsongeek lawsongeek is offline
Banned
 
Join Date: Aug 2011
Last Activity: 17 October 2015, 1:15 PM EDT
Posts: 88
Thanks: 4
Thanked 1 Time in 1 Post
cool. thanks. worked perfectly!
    #4  
Old Unix and Linux 02-03-2013
RudiC RudiC is online now Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 28 July 2016, 12:21 PM EDT
Location: Aachen, Germany
Posts: 9,044
Thanks: 176
Thanked 2,610 Times in 2,446 Posts
You could also try
Code:
$ { echo yes; echo no; } | cron-config

, or, depending on your system/shell,

Code:
$ echo -e "yes\nno" | cron-config

Sponsored Links
    #5  
Old Unix and Linux 02-03-2013
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 27 July 2016, 4:38 AM EDT
Location: Amsterdam
Posts: 10,937
Thanks: 417
Thanked 3,007 Times in 2,673 Posts

Code:
printf "%s\n" no yes | cron-config

Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
accept input on an echo output robin_simple Shell Programming and Scripting 1 02-23-2012 07:42 PM
Putting echo output as input to stat Ebodee Shell Programming and Scripting 3 08-10-2010 10:41 PM
problem piping input to script with echo mcdef Shell Programming and Scripting 1 06-25-2009 12:53 PM
usage of echo with standard input calandrea Shell Programming and Scripting 13 10-27-2008 12:11 PM
suppress echo while reading input in expect sudhir_onweb Shell Programming and Scripting 1 07-23-2007 09:54 AM



All times are GMT -4. The time now is 12:23 PM.