LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-25-2013, 05:35 AM   #1
Medallo77
LQ Newbie
 
Registered: Oct 2013
Posts: 1

Rep: Reputation: Disabled
execute a sql script and read the output to pass it to another shell


I am writing a sh script and I need to read a file that is is created in a simple sql statement.
The one oneup.dat is created correctly
then
read oneup < oneup.dat
then I need to pass the oneup to another shl
gjajobs.shl "SORAINF" "C" "${ID}" "${PW}" "${oneup}" "DATABASE" "NOMAIL" "NOSUB"
is this correct?
I am running into other errors but I don't think is related to this
sorainf: error while loading shared libraries: libicui18n.so.36: cannot open shared object file: No such file or directory
NOTE: The -j -n and -w switches are REQUIRED to run this process
the "${ID}" "${PW}" are defined on sorainf.shl

#-------------------------------------------------------------------------------------#
# change to directory where sql script is located

cd ${SCRIPT_PATH}

#----------------------------------------------------------------------------------
# Run scipt to execute the sql script that generates the oneup.dat file.

#sqlplus ${ID}/${PW} ${AT_SIGN}${SCRIPT_PATH}${SCRIPT_NAME}
sqlplus -s ${ID}/${PW} ${AT_SIGN}${SCRIPT_PATH}${SCRIPT_NAME} > oneup.dat

read oneup < oneup.dat

sqlscript=$?
if [ $sqlscript != "0" ]
then
echo "Error: could not execute the ${SCRIPT_NAME} script\n"
else
echo "Successfully executed the ${SCRIPT_NAME} script\n"
fi
#exit
cd /u01/app/dev-banner/TEST/general/misc/
gjajobs.shl "SORAINF" "C" "${ID}" "${PW}" "${oneup}" "DATABASE" "NOMAIL" "NOSUB"
exit

Last edited by Medallo77; 10-25-2013 at 06:31 AM.
 
Old 10-26-2013, 03:41 PM   #2
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 97
Quote:
Originally Posted by Medallo77 View Post
I am writing a sh script and I need to read a file that is is created in a simple sql statement.
The one oneup.dat is created correctly
then
read oneup < oneup.dat
then I need to pass the oneup to another shl
gjajobs.shl "SORAINF" "C" "${ID}" "${PW}" "${oneup}" "DATABASE" "NOMAIL" "NOSUB"
is this correct?
It depends what oneup.dat contains. This will read only the first line of the file:

Code:
read oneup < oneup.dat
Is there a reason you're passing oneup.dat as a parameter, rather than reading the file in the script?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass the output of a shell script to c++ program samasara Linux - Newbie 19 08-20-2013 02:12 AM
[SOLVED] read shell script code even if only have execute permission not read em31amit Linux - Security 7 06-12-2012 11:32 PM
Getting Shell Script to Execute IF new row in Postgres SQL is added? (PHP) gatorpower Programming 1 03-18-2009 12:45 AM
[shell script] execute command and parse output stoiss Programming 2 01-26-2009 01:49 AM
Not able to execute Oracle Sql command in shell script Ranvijaidba Programming 3 10-23-2008 03:45 PM


All times are GMT -5. The time now is 10:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration