Bash Instrcution source dosen't work

Forum rules
Before you post please read how to get help
HeeH
Level 1
Level 1
Posts: 4
Joined: Sat Mar 02, 2013 7:20 am

Bash Instrcution source dosen't work

Postby HeeH » Sat Mar 02, 2013 7:41 am

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!

User avatar
catweazel
Level 7
Level 7
Posts: 1669
Joined: Fri Oct 12, 2012 9:44 pm

Re: Bash Instrcution source dosen't work

Postby catweazel » Sat Mar 02, 2013 7:46 am

Mint Testing Team & Mint Donor #3606

HeeH
Level 1
Level 1
Posts: 4
Joined: Sat Mar 02, 2013 7:20 am

Re: Bash Instrcution source dosen't work

Postby HeeH » Sat Mar 02, 2013 8:00 am


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?

User avatar
karlchen
Level 16
Level 16
Posts: 6824
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Bash Instrcution source dosen't work

Postby karlchen » Sat Mar 02, 2013 9:08 am

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
Image
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

User avatar
bjornmu
Level 3
Level 3
Posts: 159
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: Bash Instrcution source dosen't work

Postby bjornmu » Sat Mar 02, 2013 7:25 pm

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.

HeeH
Level 1
Level 1
Posts: 4
Joined: Sat Mar 02, 2013 7:20 am

Re: Bash Instrcution source dosen't work

Postby HeeH » Tue Mar 05, 2013 10:19 am

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!

HeeH
Level 1
Level 1
Posts: 4
Joined: Sat Mar 02, 2013 7:20 am

Re: Bash Instrcution source dosen't work

Postby HeeH » Tue Mar 05, 2013 10:23 am

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!

User avatar
karlchen
Level 16
Level 16
Posts: 6824
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Bash Instrcution source dosen't work

Postby karlchen » Tue Mar 05, 2013 5:54 pm

Hello, HeeH.
You're welcome. :)
Karl
Image
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

cfaj
Level 1
Level 1
Posts: 3
Joined: Sun May 05, 2013 6:13 pm

Re: Bash Instrcution source dosen't work

Postby cfaj » Sat May 11, 2013 8:18 am

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.


Return to “Scripts & Bash”

Who is online

Users browsing this forum: No registered users and 1 guest