Why can't my scripts set environment variables?
Greetings. This is my first post on this forum. I am trying to make my computer set some environment variables as follows (the exact variables aren't really important for this question):
CPPFLAGS='-I/opt/glibmm/include -I/opt/gtk/include -I/opt/gtkmm/include -I/opt/libsigc++/include -I/opt/xine-lib/include $CPPFLAGS' LDFLAGS='-L/opt/glibmm/lib -L/opt/gtk/lib -L/opt/gtkmm/lib -L/opt/libsigc++/lib -L/opt/xine-lib/lib $LDFLAGS' PKG_CONFIG_PATH='/opt/glibmm/lib/pkgconfig:/opt/gtk/lib/pkgconfig:/opt/gtkmm/lib/pkgconfig:/opt/libsigc++/lib/pkgconfig:/opt/xine-lib/lib/pkgconfig:$PKG_CONFIG_PATH' LD_LIBRARY_PATH='/opt/glibmm/lib:/opt/gtk/lib:/opt/gtkmm/lib:/opt/libsigc++/lib:/opt/xine-lib/lib:$LD_LIBRARY_PATH' PATH='/opt/gtk/bin:/opt/xine-lib/bin:/opt/xine-ui/bin:$PATH' export CPPFLAGS LDFLAGS PKG_CONFIG_PATH LD_LIBRARY_PATH PATH If I paste these lines into the shell, they work for that instance of the shell. When I restart the shell, I must repaste them. If I put them in ~/.bash_profile, they have no effect. If I put them into a file and run that file, it has no effect whatsoever. What am I doing wrong? I'm using Fedora Core 2 if that makes any difference. Thanks in advance! |
Welcome to LQ.
They will only last for the duration of that script. You will need to source the script into your shell using iether of: source /path/to/script . /path/to/script |
Thanks! That made the script commands work as I wanted (I also had to change my apostrophes to quotes). What is the best way to make the script run every time I open the console if I only want it to apply to my account?
|
Try putting them in your ~/.bashrc script instead.
|
If you put them in ~/.bash_profile they'll take effect the next time you log in. bash_profile is a good way to set variables to be available from any shell.
bashrc will only set variables for non-login shells, unless you have "source $HOME/.bashrc" in ~/.bash_profile |
Putting it in ~/.bashrc worked. Thanks!
|
All times are GMT -5. The time now is 10:27 PM. |