LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-25-2008, 03:41 PM   #1
grndfl
LQ Newbie
 
Registered: Jul 2008
Distribution: openSUSE 10.3 x86-64
Posts: 8

Rep: Reputation: 0
help with shell variables/commands


Hi
I'm having some trouble with my shell(konsole using Opensuse), I want to change the gcc command to use a different version of gcc. However I don't know how to do this.

Also is it possible to have have a local command of gcc, say if I invoke gcc as a user a certain version is used and if I login as admin another version is used? If so how would I do that

thanks in advance
Dan Lavigne
 
Old 07-25-2008, 04:59 PM   #2
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
In your .bashrc file put a line which says

Code:
alias gcc='/path/to/other/version/of/gcc'
Close Konsole and launch it again. This will affect only your sessions. If you log in as 'admin' (I assume you mean root) then the default gcc will be used.
 
Old 07-25-2008, 06:06 PM   #3
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by grndfl View Post
I'm having some trouble with my shell(konsole using Opensuse), I want to change the gcc command to use a different version of gcc. However I don't know how to do this.
You might want to use different paths. GCC versions are usually installed in separate locations and seem to use some path parsing to figure out where to find libraries. You can create a script
Code:
# Set the path to the desired gcc version
export OLDPATH=$PATH
export PATH=/path/to/gcc/bin:$PATH
Then source the script using
Code:
[auser@amachine:~] . setpath
This will prefix your path with the path to the version you want to use and save your current path in OLDPATH.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
assign commands to Variables tazbv Programming 2 08-03-2007 03:07 AM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 03:34 PM
commands stored into variables? benne Programming 2 11-15-2004 08:20 PM
How to echo variables and commands in one line? hindll01 Programming 1 09-10-2004 07:02 AM
Putting variables in everyday used commands tearinox Programming 2 04-29-2004 06:08 PM


All times are GMT -5. The time now is 01:21 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration