Operating System - HP-UX
1855738 Members
5344 Online
104103 Solutions
New Discussion

Re: Need a little help with a script

 
SOLVED
Go to solution
Brahnda Eleazar
Frequent Advisor

Need a little help with a script

Peace all,

This is a modified snippet of a script I'm trying to write:

********************************

FILE_NAME=$OUTPUT_DIR"/SEC101.log"

sqlplus /nolog <conn / as sysdba
spool "$FILE_NAME"
SELECT * FROM V\$VERSION
quit
FILEOF

grep -v "SQL>" $FILE_NAME > $TEMP_FILE
echo "Done!"
echo "Continuing to section 2..."

********************************

Well, anything I write after the closing FILEOF (the last 3 lines) didn't seem to be executed at all.

Did I miss something or do something wrong?

Thanks,
=adley=
5 REPLIES 5
Yarek
Regular Advisor
Solution

Re: Need a little help with a script

Adley,

Please try to run the script in debug mode:

sh -x

Maybe it will help...


rgds,
Yaroslav
Dennis Handly
Acclaimed Contributor

Re: Need a little help with a script

Is your here document terminator "FILEOF" at the start of the line?

If you have leading tabs, you need <<-FILEOF.
Brahnda Eleazar
Frequent Advisor

Re: Need a little help with a script

Peace guys,

Yaroslav, thanks, sh -x somehow slipped my mind. I was too busy swearing :)

Dennis, thanks, you're right, in my original script file, there was something in front of FIELOF. Not a tab, but some spaces. Apparently it's the spaces that caused this, don't know why. Deleting all the spaces solved the problem. Or replace them with tabs and specify -FILEOF at the beginning did the trick as well.

Thanks a lot guys,
=adley=
PAVIC Thierry
Frequent Advisor

Re: Need a little help with a script

I try your script : it seems to be good, do you have something in your FILE_NAME=$OUTPUT_DIR"/SEC101.log"
file may be you don't have the right to write your file

Do you connect succesfully with / as sysdba ?
may be the connection ask a passwd
Brahnda Eleazar
Frequent Advisor

Re: Need a little help with a script

Peace PAVIC Thierry,

The problem has been solved. The root cause is as I said in my previous post :)
Somehow spaces and tabs are the culprits, not read/write permission and not the SYS password. Don't ask me why though, 'cause I just know this myself.

=adley=