I'm trying shell script to automatically accept value as Y when prompted in script but somehow it always say "Operation cancelled at user request". The nid
command is an Oracle utility DBNEWID for changing a database name.
Any idea on how to accept Y in below function? Function logs into database and changes name.
function rename_db {
nid target=SYS/"as sysdba" DBNAME=newdb << EOD
Y
EOD
}
Runtime output:
Change db ID and name to newdb? (Y/[N]) =>
Operation cancelled at user request