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.
I have a product, lets call it GGM, This product has two versions
GGM1 and GGM2. If I only run one of them it is all fine but how do I set up GGM_HOME to two different paths? I am not able to change the variable GGM_HOME? Anyone that knows?
that's an extremely bizaarely phrased question, what's wrong with actually stating what you're doing? maybe you work for the FBI? we can only help you if you give some useful information
0x0001:
Yes I use export GGM_HOMEath/path/GGM1
which works for the first one, but what to do with the other, with GGM2. It uses GGM_HOME too?
acid_kewpie:
Does it really matter what the product is called, you would not know what it was anyway, also it is a product my company is developing so I am not allowed to tell...
because so many people incorrectly decide what the problem and so want to know how to fix what they think the problem is, without letting us know the circumstances to make sure they DO know what the problem is...
so with your secret program you will presumably need to run each instance inside it's own shell environment, maybe this will be easiest by having a shell script for each instance, assuming you can name them in a hard coded sense. so just have
in say... a "ggm1" script file, and just copy it and change the needed for the other one. should be fine. might want to export the variable as you set it aswell. not sure.
Well my problem is I do not know how to make two GGM_HOMES to two different paths. Since I too develop this product I am pretty sure what to do to “fix” it. But my question is:
how can I make to exports with the same variable (GGM_HOME) to two different paths?
Why do I have to make a shellscript? Does it help me to run two instances and two versions of this product? With only one instance I do not need a shellscript. But this export is included in a file called /etc/profile.local. How do I put both of them there?
well you can't put it there. if your program takes in an environmental variable then it will naturally have to deal with the contents of it, maybe you could develop your program to deal with having two directories in a variable. that'd be a pretty hacky approach. the whole thing here is that that's just not the way program deal with situations like this. you would typically be able to specify a configuration file other than the default one.
the example i gave about opening a new shell for each is based around scope. presumably you are aware of scope issues with your programming, and it's exactly the same outside the program, you would set the variable local only to that shell instance, not the entire system.
so you can have two different environmental varaibles existing within seperate scopes.
acid_kewpie
The reason why I need to instances is that I need the old version of the product running in the same time as the new.. So customers can see what new enhancements is done with the new product. But since GGM2 is an upgrade of GGM1 it uses the same path. I will try the separate code suggestion..
fundamentally you can't have two variables of the same name in the same scope. you either need a different varaibale name or a different scope, and it seems that only the latter is possible. but then like i said a config file would be more traditional
acid_kewpie
fundamentally you can't have two variables of the same name in the same scope. you either need a different varaibale name or a different scope, and it seems that only the latter is possible. but then like i said a config file would be more traditional
You mean: I cannot have one variable pointing at two different paths?
What is “scope”?
Also I wrote wrong in my last contribution. I meant GGM2 is an upgrade of GGM1 it uses the same variable and the path is different.
Anyway my linux did not make any complaints when I had a : mark in between the paths. Now I need to configure my files and then I will see if it works..
I want to be the proverbial fly on the wall to see AQ when he is replying to this thread
Maybe move it to programming and someone else will chime in with suggestions? And change the name, 2 homes I thought it was going to be about connecting your LAN to your buddy's or can I use my ISP when I'm on vacation or something like that.
I have finally solved it, thanks for all the help.
To export one variable to two different paths was quite easy in the end. First write the first one and on the row beneath write the second one in this profile.local file. And then export it.
Then of course make all the correct changes in all the configuration files affected..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.