[ale] Bash Scripting: How to pass "yes" + carriage return?

Mike Harrison meuon at geeklabs.com
Fri Nov 11 08:33:58 EST 2005


Ryan Fish requested: 

> I am in need of figuring out how to pass a "yes" followed by a carriage
> return via a bash script so a backup process can run successfully each day.

> 1) ssh to RaQ server as root
> 2) run cmuExport
> 3) copies contents of export to NAS device

I don't know cmuExport, but I would hope/expect it to has a command line 
switch for 'OverWrite' but if not, take a look at the 'expect' utility 
program: 

"Expect is a program that "talks" to other interactive programs accord-
 ing to a script.  Following the  script,  Expect  knows  what  can  be
 expected  from  a program and what the correct response should be.  An
 interpreted language provides branching and high-level control  struc-
 tures  to direct the dialogue.  In addition, the user can take control
 and interact directly when desired, afterward returning control to 
 the script."







More information about the Ale mailing list