Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: 0
help with shell variables/commands

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, 03:59 PM   #2
Senior Member
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,093

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

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, 05:06 PM   #3
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
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
# Set the path to the desired gcc version
export PATH=/path/to/gcc/bin:$PATH
Then source the script using
[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.


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 02:07 AM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 02:34 PM
commands stored into variables? benne Programming 2 11-15-2004 07:20 PM
How to echo variables and commands in one line? hindll01 Programming 1 09-10-2004 06:02 AM
Putting variables in everyday used commands tearinox Programming 2 04-29-2004 05:08 PM > Forums > Linux Forums > Linux - Newbie

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

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