Bash Instrcution source dosen't work

Forum rules
Before you post please read how to get help

Bash Instrcution source dosen't work

Postby HeeH on 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!
HeeH
Level 1
Level 1
 
Posts: 4
Joined: Sat Mar 02, 2013 7:20 am

Linux Mint is funded by ads and donations.
 

Re: Bash Instrcution source dosen't work

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

Mint Testing Team & Mint Donor #3606
KDE 4.12.0, custom preemptive kernel 3.12.5,
Intel i7 4770K @ 4.7GHz, 16GB 2666MHz XMP,
4 Samsung 840 PRO 512GB SSDs in RAID0,
6TB HW RAID10, dual 24" Acer X243H,
Gigabyte nVidia GTX 680 Super Overclock
User avatar
catweazel
Level 7
Level 7
 
Posts: 1655
Joined: Fri Oct 12, 2012 9:44 pm

Re: Bash Instrcution source dosen't work

Postby HeeH on 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?
HeeH
Level 1
Level 1
 
Posts: 4
Joined: Sat Mar 02, 2013 7:20 am

Re: Bash Instrcution source dosen't work

Postby karlchen on 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
User avatar
karlchen
Level 12
Level 12
 
Posts: 4174
Joined: Sat Dec 31, 2011 7:21 am

Re: Bash Instrcution source dosen't work

Postby bjornmu on 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.
User avatar
bjornmu
Level 3
Level 3
 
Posts: 160
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: Bash Instrcution source dosen't work

Postby HeeH on 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 on 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!
HeeH
Level 1
Level 1
 
Posts: 4
Joined: Sat Mar 02, 2013 7:20 am

Re: Bash Instrcution source dosen't work

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

Hello, HeeH.
You're welcome. :)
Karl
User avatar
karlchen
Level 12
Level 12
 
Posts: 4174
Joined: Sat Dec 31, 2011 7:21 am

Re: Bash Instrcution source dosen't work

Postby cfaj on 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.
cfaj
Level 1
Level 1
 
Posts: 3
Joined: Sun May 05, 2013 6:13 pm

Linux Mint is funded by ads and donations.
 

Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 1 guest