Guest mastemmer Posted July 20, 2007 Report Share Posted July 20, 2007 I have been using other Linux distributions for some time, but i am new to Mandriva. I want to use a startup script such as .profile or .bashrc to define and export some environment variables such as export CVSROOT=path/to/my/cvsroot export CVS_RSH=ssh If i type this in a command line the variables are defined as expected. I can check this with echo $CVSROOT The trouble is that if i run these variable definitions as a shell script, they simply take no effect. The variable definitions are not exported out of the script. What is missing? Quote Link to comment Share on other sites More sharing options...
theYinYeti Posted July 20, 2007 Report Share Posted July 20, 2007 For your commands to take effect, you have to source the script, not execute it. Here's the syntax: $ . ./script.sh The first dot can be replaced with the keyword "source". It is however a good idea to place those lines in the login scripts as you suggested. Did you try the ".bash_profile" file? This should be the appropriate file if you use bash as your login shell. Yves. Quote Link to comment Share on other sites More sharing options...
Guest mastemmer Posted July 20, 2007 Report Share Posted July 20, 2007 Thank you so much Yves, that is it. Running the script as source ./script.sh really works. Also placing my environment definitions in .bash_profile makes it work on startup. M. Stemmer Quote Link to comment Share on other sites More sharing options...
iphitus Posted July 20, 2007 Report Share Posted July 20, 2007 Not a good idea to put CVS variables in bash_profile, as if you ever need to use another CVS directory, it could cause some problems. Quote Link to comment Share on other sites More sharing options...
Guest mastemmer Posted August 2, 2007 Report Share Posted August 2, 2007 Not a good idea to put CVS variables in bash_profile, as if you ever need to use another CVS directory, it could cause some problems. Maybe, but I had no problem using -d option to access other CVS directories. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.