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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The << Operator and Running Apps From a Script 2

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello,

On Sun Solaris 8 I have the below Bourne shell script.
Code:
$ORACLE_HOME/bin/sqlplus / << SQLPLUS_SESSION
SELECT * FROM mytable;
SQLPLUS_SESSION

I use this techniqe alot to have an the Oracle sqlplus tool run using the commands I need all from a Bourne shell script.

My problem is that the commands on the 2nd and 3rd line must behave like they are at the beginning of the line, i.e. if I indent line 2 the script fails.

How can I use this technique (<< MYVAR) and be able to indent? I have been trying to put the command on one line but do not quite have it (this would work too). Unsuccessful example:
Code:
$ORACLE_HOME/bin/sqlplus / << SQLPLUS_SESSION SELECT * FROM mytable; ...

What advice can you give?

Thanks,

Michael42
 
In your shell man page read the Input/Output redirection section and pay attention to this syntax:
ORACLE_HOME/bin/sqlplus / << - SQLPLUS_SESSION
[tab char]SELECT * FROM mytable;
SQLPLUS_SESSION

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Guys that worked very well!

One more follow up please...

How can I specify\respecify how many spaces make up a tab?

My goal is to make my code easier to read. If I can redefine the tab stop in my script that would be great.

Thanks again all,

Michael42
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top