I have been beating my head on the table for almost 2 days now Googling and trying to figure out how to do this. It sounds easy enough I just am not going about it the right way obviously.
I am trying to create a script that will send an updated tnsnames.ora file down to a few of my Linux servers, running SLES, that will also update the Oracle tnsnames environment variable. It is basic but I can't figure out how to add this value:
Code:
TNS_ADMIN=/opt/tnsnames
export TNS_ADMIN
at the end of the /etc/profile but above the lines:
Code:
#
# End of /etc/profile
#
So in short I am trying to get the end of my /etc/profile file to look like this:
Code:
TNS_ADMIN=/opt/tnsnames
export TNS_ADMIN
#
# End of /etc/profile
#
Here is what I have minus the placement part in which I am trying to get figured out.
Code:
#!/bin/sh
mkdir /opt/tnsnames
cd /opt/tnsnames
wget http://webserver/tnsnames.ora
echo "TNS_NAMES=/opt/tnsnames" >> /etc/profile
echo "export TNS_NAMES" >> /etc/profile
Any help on this would be greatly appreciated. I have been trying to find the line # End of /etc/profile and then 2 lines up add the 2 lines noted above. Not sure if there is an easy way or more efficient but I am unable to figure it out.