ErAB
ErAB

Reputation: 925

Purpose of line : source ~oracle/.bash_profile in shell script

While executing a shell script involving database connection, my script showed me an Error :sqlplus not found :

sqlplus -s username/paswd@DB_name  > /home/user/sql.out << EOF

But when i included the following statement, it started to work:

source ~oracle/.bash_profile

What is the purpose of this above line ?

Upvotes: 1

Views: 1266

Answers (2)

Brian Agnew
Brian Agnew

Reputation: 272427

That line includes the referenced shell script (in this case the .bash_profile from the Oracle home directory).

It's a simple means of decomposing shell scripts into smaller components and thus enabling reuse.

Upvotes: 1

user180100
user180100

Reputation:

This includes ~oracle/.bash_profilein the script where the line source ~oracle/.bash_profile is.

In your case it probably add the directory of Oracle bin in your PATH.

see also source/dot man page

Upvotes: 1

Related Questions