Reputation: 1167
Below is my simple bash script:
#!/bin/bash
cd /app/oracle/client11_2/
connect <<EOF
@/app/oracle/client11_2/testquery.sql
exit;
EOF
Note: testquery.sql contains some "SELECT" queries and also i have used spool to store the content of the queries.
But, when i execute the bash script on the terminal, it produces lot of unwanted output like below:
SQL*Plus: Release 11.2.0.3.0
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
How to avoid this output..!? I do not want this to be printed on the output screen when i execute the bash script.
Upvotes: 0
Views: 1610
Reputation: 35401
You can suppress the SQL*Plus header messages by using the -s flag
sqlplus -s
That said, your snippet shows a connect but not the sqlplus invocation itself. Not sure where that is being hidden.
Upvotes: 2
Reputation: 42137
Make the here doc (<<
) snippet as:
connect <<EOF >/dev/null
@/app/oracle/client11_2/testquery.sql
exit;
EOF
this sends the STDOUT of the here doc to /dev/null
.
You can also do the output redirection at run time, sending the whole STDOUT of the script to /dev/null
e.g.:
./script.sh >/dev/null
again this sends the whole STDOUT of the script to /dev/null
(YMMV).
Upvotes: 0