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: 4 December 2016, 9:12 PM EST
Location: NM
Posts: 10,876
Thanks: 457
Thanked 987 Times in 917 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 offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 4 December 2016, 12:28 PM EST
Location: Aachen, Germany
Posts: 9,901
Thanks: 199
Thanked 2,942 Times in 2,747 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: 4 December 2016, 10:28 PM EST
Location: Amsterdam
Posts: 11,101
Thanks: 440
Thanked 3,108 Times in 2,749 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 08:42 PM
Putting echo output as input to stat Ebodee Shell Programming and Scripting 3 08-10-2010 11:41 PM
problem piping input to script with echo mcdef Shell Programming and Scripting 1 06-25-2009 01:53 PM
usage of echo with standard input calandrea Shell Programming and Scripting 13 10-27-2008 01:11 PM
suppress echo while reading input in expect sudhir_onweb Shell Programming and Scripting 1 07-23-2007 10:54 AM



All times are GMT -4. The time now is 04:28 AM.