SysAdminUnix
MIS
Hi All,
Need help with a script. I'm creating a menu driven script for several users. Part of this script is a statement in Oracle. After selecting a menu option a second script is called to execute the oracle statement. The results are stored in a spoolfile, which then is displayed with the more option in the menuscript. I chose for this option because users can then display the same statement again without asking the database.
Whatever I try the string is executed before it is passed in the oracle script. Tried "export var" and write it to a file. Even the use of the backslash before the asterix did not work. Anyone any suggestions? Below (parts) of both scripts with both used options.
script1:
script2:
Need help with a script. I'm creating a menu driven script for several users. Part of this script is a statement in Oracle. After selecting a menu option a second script is called to execute the oracle statement. The results are stored in a spoolfile, which then is displayed with the more option in the menuscript. I chose for this option because users can then display the same statement again without asking the database.
Whatever I try the string is executed before it is passed in the oracle script. Tried "export var" and write it to a file. Even the use of the backslash before the asterix did not work. Anyone any suggestions? Below (parts) of both scripts with both used options.
script1:
Code:
export var="select * from dual;"
echo "select * from dual;">command
script2
script2:
Code:
echo ${var} #translates the * into the file list of the current dir
var2=`cat /home/root/command` #translates the * into the file list of the current dir
(${sqlprog} -s ${userid} <<-EOF) >> ${errorlog} 2>&1
set heading off
set feedback off
set echo off
set pause off
set term off
set serveroutput on size 999999
spool ${spoolfile}
${var} #or ${var2}
exit
EOF