Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

transferring variable to another script doesn't work

Status
Not open for further replies.
Sep 1, 2003
10
0
0
NL
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:
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
 
echo [!]"[/!]${var}[!]"[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thx PHV for you're reply,

Already have tried this, but did it again. Just to find out that I made a typing error. In the line above the character "\" was added at the end of the line. :-(
off course it didn't work. Just overlooked it for 2 whole days...
 
Try this:

script1
Code:
export var='select * from dual;'
echo "${var}">command
script2
script2
Code:
  (${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} 
  exit
EOF
[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top