LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   return key on shell script (http://www.linuxquestions.org/questions/programming-9/return-key-on-shell-script-33447/)

chupacabra 10-22-2002 11:57 AM

return key on shell script
 
kernel : 2.4.48-14
distro: redhat 8.0
shell: BASH

Which symbol or command is the Return key? I mean, to make the shell script to press "enter" automatically?

I'm trying to automate this one command via cron. The rest of the script runs fine but after the following line it asks me to press return.

#!/bin/bash
cdbkup 0 --label=TEST -s 4 0,0,0 /home
#then it asks me to press return and I have to do it manually otherwise it doesnt go on


I know it's kind of a dumb question but I'm a newbie.
Thanks!

Hko 10-22-2002 12:22 PM

I don't know about cdbkup, but the following probably helps:
Code:

#!/bin/bash
yes '' | cdbkup 0 --label=TEST -s 4 0,0,0 /home

The "yes" command produces a continuous stream of 'y' characters followed by 'enters' by default. When you pipe ( '|' ) this to another command it answer 'y' to all questions the command ('cpbkup' in your case) asks from the standard input ("stdin"). You can have 'yes' output a continuous stream of -say- '#' by using "yes '#' ". Or pass it an empty character ( '' - two single quotes) to pass a endless stream of "enters" to the other command.

Hope this helps.

chupacabra 10-22-2002 01:11 PM

thanks bro, it worked
 
thank you so much, it's all beautiful now.

chupacabra:D


All times are GMT -5. The time now is 02:38 PM.