Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

Problem with using ifort command in csh scripts in debian and ubuntu

hossein309
Beginner
1,316 Views
hi guys
i used source command for enviroment setup of ifort command as :
source /opt/intel/Compiler/.../ifortvars.sh ia32
it works well when i use ifort in bash and csh shell but when i try use ifort in a csh script it doesn't work !
this probelm only occoures in debian and ubuntu and i do this job in opensuse with no problem.
please help me
0 Kudos
4 Replies
Ron_Green
Moderator
1,316 Views
First, for csh you must source ..../ifortvars.csh ia32

Second, your first line of the script must be:

#!/bin/csh

Next, you may have a ~/.cshrc or other startup script that is resetting the env for the subshell invoked by the csh script. Normally child shells inherit their parent's env, but your .cshrc could be overriding things. Move it out of the way and see if that makes a difference.

If all else fails, add the source ../ifortvars.csh ia32 as the second line in your script.

There is no reason this will not work, and I wrote a simple csh script invoked from csh to confirm that it works fine on my Ubu 9.04 system.

ron
0 Kudos
hossein309
Beginner
1,316 Views
First, for csh you must source ..../ifortvars.csh ia32

Second, your first line of the script must be:

#!/bin/csh

Next, you may have a ~/.cshrc or other startup script that is resetting the env for the subshell invoked by the csh script. Normally child shells inherit their parent's env, but your .cshrc could be overriding things. Move it out of the way and see if that makes a difference.

If all else fails, add the source ../ifortvars.csh ia32 as the second line in your script.

There is no reason this will not work, and I wrote a simple csh script invoked from csh to confirm that it works fine on my Ubu 9.04 system.

ron

when i try to source .../ifortvars.csh ia32 i get such error:
bash: /opt/.../ifortvars.csh: line 10: syntax error near unexpected token "$1" '
bash: /opt/.../ifortvars.csh: line 10: switch ("$1") '
0 Kudos
Ron_Green
Moderator
1,316 Views
Quoting - hossein309

when i try to source .../ifortvars.csh ia32 i get such error:
bash: /opt/.../ifortvars.csh: line 10: syntax error near unexpected token "$1" '
bash: /opt/.../ifortvars.csh: line 10: switch ("$1") '

This means you are in bash shell and not csh. You can confirm this with:

echo $0

which prints your shell. I was surprised that source .../ifortvars.sh would work for csh; it should not work.

How do you get into csh? Bash is the default for Ubuntu. You also have to explicitly apt-get install csh tcsh for Ubu desktop as it is not installed by default.


0 Kudos
hossein309
Beginner
1,316 Views

This means you are in bash shell and not csh. You can confirm this with:

echo $0

which prints your shell. I was surprised that source .../ifortvars.sh would work for csh; it should not work.

How do you get into csh? Bash is the default for Ubuntu. You also have to explicitly apt-get install csh tcsh for Ubu desktop as it is not installed by default.



YES !!! IT IS CORRECT !!!
I was in bash and tried to source /.../ifrotvars.csh
Thank you so much
0 Kudos
Reply