Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I'm trying to create a bash script to install an application that requires Oracle 11g client.

How can I read in the version info within the bash script?

sqlplus when run in Putty spits out the answer. However, when I use sqlplus in the bash script it wants to connect to the DB.

share|improve this question

1 Answer 1

I just ran sqlplus user/password@sid on a 64-bit Red Hat server. This was on stdout:

SQL*Plus: Release 11.2.0.2.0 Production on Wed Jun 24 17:27:57 2015

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Note that it gives the version of Oracle that sqlplus belongs to, and the version that's running the actual database.

Just to get the version of Oracle that sqlplus belongs to you could do this:

sqlplus /NOLOG < /dev/null | grep Release | cut -d' ' -f3
share|improve this answer
    
Thank you Bruce. That did the trick! –  triplus Jun 25 at 16:55
    
@triplus - Glad I could help. The custom is to upvote good answers, and mark the best or correct answer. –  Bruce Ediger Jun 25 at 17:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.