Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
let say if I have 2 database on the Linux server and long with that I also had a third party running on the same server. Any way, what I want to ask is the following:
set env for each database, let say if I want to be on the first env along with the third party software to run ok, I have to do:
export ORACLE_SID=test1 (where test1 is the database SID of the first instance)
export SDEHOME=/home/sde/sdeexe83 (where /home/sde/sdeexe83 is the home of the software for the first instance)
so if I want to switch to the second database along with the different home for the third party sfotware I have to do the following:
export ORACLE_SID=test2 (where test2 is the database SID of the second instance)
export SDEHOME=/home/sde/sdeexe83_2 (where /home/sde/sdeexe83_2 is the home of the software for the second instance)
the question is "what can I do to switch env without typing each time, another way, the shorter way to change env)
I'm going to say "./test.sh 1" if you want to export ORACLE_SID=test1 and "./test.sh 2" for test2
However, the naming is slightly different (i tend to not use extensions on scripts...just put them all in a specific directory in my path)..I assume it would work the same, though.
Here's my setup, for reference:
1) create a directory called "scripts" in my home
2) in ~/.bashrc add PATH=$PATH:~/scripts
3) dump all my scripts in ~/scripts
4) chmod 700 ~/scripts/*
No need to specify a path now...I just do "test 1" and it'll run ~/scripts/test with an argument of "1".
"test" isn't really a good name for a script, though, since there's already a commonly used executable called "test"
I don't think so. I asked about the error message just to see if the script was running at all.
If those commands work properly when you run them from commandline, then there's something wrong with my script.
Or perhaps you'd need to check env in a new shell after you run the script before you'll see the changes.
Perhaps it's reading the numbers as numbers rather than strings? Doesn't seem so, but I can't think of anything else at the moment.
Just to humor me, could you change the "1" and "2" to "one" and "two", and see if it makes a difference (if the new shell thingy doesn't work)?
What I was getting at was you may have to open a new terminal and check your environment from that. It's possible that the changes won't affect your current bash session
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.