[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

How can invoke an automatic "Y" in a script?

I have a small script:
--------------------
mt rewind          
dd if=/dev/rmt/0n of=/dev/null  
/app_dsk/usr/dlc/bin/prorest apmdb /dev/rmt/0n
--------------------

it is called by running the filename:
--------------------
apmdb.rest
--------------------
Problem is, that the program the script runs, always asks the question:
File Exists, Overwrite? (Y/N)
I have to manually press "Y" everytime.
How can I make the "Y" be entered automatically without me doing it?
0
rbend
Asked:
rbend
1 Solution
 
NukfrorCommented:
Use a HERE document in Bourne shell:

sh apmdb.rest <<ENDHERE
Y
ENDHERE

The ENDHERE part is simply something you choose - ENDHERE is what I've always used.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now