LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-29-2008, 04:06 AM   #1
monkey_king
LQ Newbie
 
Registered: Jun 2008
Posts: 4

Rep: Reputation: 0
cant "source" bash script with arguments (PATH updating)


I'm trying to install icc compiler 11.0

I've got this script here located at /opt/intel/compiler/11.0/0.74/bin/iccvars.sh

Code:
#!/bin/bash
case "$1" in
  ia32)
      if [ -e /intel/cc/10.0.023/intel/Compiler/11.0/074/bin/ia32/iccvars_ia32.sh ]; then
         . /intel/cc/10.0.023/intel/Compiler/11.0/074/bin/ia32/iccvars_ia32.sh 
      fi
      ;;
  intel64)
      if [ -e /intel/cc/10.0.023/intel/Compiler/11.0/074/bin/intel64/iccvars_intel64.sh ]; then
         . /intel/cc/10.0.023/intel/Compiler/11.0/074/bin/intel64/iccvars_intel64.sh 
      fi
      ;;
esac
The files iccvars_ia32.sh and 64.sh, should update the PATH.

If I run
source iccvars_ia32.sh it works.
But if i try to call this wrapper called iccvars.sh it doesn't update anything.

Thanks in advance
 
Old 12-29-2008, 04:43 AM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
In any case you would need to source the wrapper. Otherwise the scripts would be sourced withing the subshell where the iccvars.sh wrapper is run, which won't modify the parent environment (I guess that's what you intend).
 
Old 12-29-2008, 08:10 AM   #3
monkey_king
LQ Newbie
 
Registered: Jun 2008
Posts: 4

Original Poster
Rep: Reputation: 0
hi,
maybe I wasn't clear.

Even if I try sourcing the wrapper it doesn't work
 
Old 12-29-2008, 08:39 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
A similar construct works for me. Are you sure about the passed argument? What command line did you used to source the wrapper and where did you put it (e.g. in $HOME/.bashrc)?
 
Old 12-30-2008, 04:08 AM   #5
monkey_king
LQ Newbie
 
Registered: Jun 2008
Posts: 4

Original Poster
Rep: Reputation: 0
No I don't put the source command in any dotfiles,
I just source it in the promt.


I type in

source iccvars.sh
 
Old 12-30-2008, 04:34 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by monkey_king View Post
I type in

source iccvars.sh
I take it literally: if you don't pass any argument, no condition is satisfied in the case construct. You have to do one of the following:
Code:
source iccvars.sh ia32
source iccvars.sh intel64
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
Xfce terminal shows "bash-3.11" instead of the path jsmith6 Slackware 5 01-13-2008 02:30 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
How to write a bash script to replace all "KH" to "K" in file ABC??? cqmyg5 Slackware 4 07-24-2007 09:00 AM
BASH says "too many arguments" in terminal tmitch70377 Linux - Newbie 4 12-06-2003 05:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration