Page 1 of 1

Bash Instrcution source dosen't work

Posted: Sat Mar 02, 2013 7:41 am
by HeeH
Hello everyone~!

Now I have a urgent porblem: I have tried to install ifort( intel fortran compiler ) on my laptop with mint 14. After the install, I runned the instruction
" source /opt/intel/composer_xe_2013.2.146/bin/compilervars.sh intel64 "
to set the enviroment variables. In the same shell, it worked. But when i quited the shell window and created another shell window to run ifort, the system told me that he can not find instruction ifort.
I have tried to run shell as superuser, but that do not change the enviroment variables either: New window can not run ifort.
I think that is a dirty joker to users and make me a little angry.
Can anyone tell me how to solve that problem? thanks very much!

Re: Bash Instrcution source dosen't work

Posted: Sat Mar 02, 2013 7:46 am
by catweazel

Re: Bash Instrcution source dosen't work

Posted: Sat Mar 02, 2013 8:00 am
by HeeH
I doubt that it is not the problem of Intel: The ifort ran well but i can not modify the enviroment variables. Is there anyway that I can run "source" in shell truely as superuser?

Re: Bash Instrcution source dosen't work

Posted: Sat Mar 02, 2013 9:08 am
by karlchen
Hello, HeeH.
After the install, I runned the instruction
" source /opt/intel/composer_xe_2013.2.146/bin/compilervars.sh intel64 "
to set the enviroment variables. In the same shell, it worked. But when i quited the shell window and created another shell window to run ifort, the system told me that he can not find instruction ifort.
This suggests that you will have to put the commandline

Code: Select all

 source /opt/intel/composer_xe_2013.2.146/bin/compilervars.sh intel64 
into your personal .bashrc file.

Karl

Re: Bash Instrcution source dosen't work

Posted: Sat Mar 02, 2013 7:25 pm
by bjornmu
Environment variables are not "global", they only have effect within the shell that you set them. So it's as expected that they don't work when you open another shell. But if you put this in your .bashrc as suggested, it will be run whenever you start a new shell.

Re: Bash Instrcution source dosen't work

Posted: Tue Mar 05, 2013 10:19 am
by HeeH
karlchen wrote:Hello, HeeH.
After the install, I runned the instruction
" source /opt/intel/composer_xe_2013.2.146/bin/compilervars.sh intel64 "
to set the enviroment variables. In the same shell, it worked. But when i quited the shell window and created another shell window to run ifort, the system told me that he can not find instruction ifort.
This suggests that you will have to put the commandline

Code: Select all

 source /opt/intel/composer_xe_2013.2.146/bin/compilervars.sh intel64 
into your personal .bashrc file.

Karl
Thanks very much! It works! Now I am compiling my project of fortran for my course. Thank you for your help!

Re: Bash Instrcution source dosen't work

Posted: Tue Mar 05, 2013 10:23 am
by HeeH
bjornmu wrote:Environment variables are not "global", they only have effect within the shell that you set them. So it's as expected that they don't work when you open another shell. But if you put this in your .bashrc as suggested, it will be run whenever you start a new shell.
Thanks very much! Now I begin to understand how the Linux deals with environment variables: it is different from the windows. Thank you for your help!

Re: Bash Instrcution source dosen't work

Posted: Tue Mar 05, 2013 5:54 pm
by karlchen
Hello, HeeH.
You're welcome. :)
Karl

Re: Bash Instrcution source dosen't work

Posted: Sat May 11, 2013 8:18 am
by cfaj
bjornmu wrote:Environment variables are not "global", they only have effect within the shell that you set them. So it's as expected that they don't work when you open another shell. But if you put this in your .bashrc as suggested, it will be run whenever you start a new shell.
Environment variables, i.e. those that are exported, are available to all descendants shells.

Note that the source command is specific to bash, and not available in sh (which is dash on Debian-based systems); use '. scriptname' instead.