Quote:
Originally Posted by richard158
hi
i am using ubuntu and i am a recent escapee from windows. I am using Codesourcery to carry out arm programming with linux. Codesourcery is not in my command path so i manually alter it using the PATH command and it works ok.
But i want to set it so i do not have to alter the command path manually. I have read can do this by editing bashrc and bash profile. When i look in my bash_profile file it says:
-----------------------------------------------------------------------
# New environment setting added by Sourcery G++ Lite for ARM GNU/Linux on Thu Oct 15 18:23:49 GMT 2009 1.
# The unmodified version of this file is saved in /home/richard/.bash_profile1387769153.
# Do NOT modify these lines; they are used to uninstall.
PATH="/home/richard/CodeSourcery/Sourcery_G++_Lite/bin:${PATH}"
export PATH
# End comments by InstallAnywhere on Thu Oct 15 18:23:49 GMT 2009 1.
-----------------------------------------------------------------------
this must have been set when i installed codesourcey. and the file .bash_profile1387769153 is empty . this codesourcery path does not work as my path is:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
how can i automatically add codesourcey to my path?
thanks
Richard
|
Do you want to be able to find and execute a program without adding to your path? If so, do it this way:
Code:
# ln -nsf (full path to executable) /usr/local/bin
The above command creates a symbolic link from your executable to a common directory that is part of your path. After you have done this, you can type the name of the program you want -- just like any other -- and it will run without any changes to your path.
The same trick can be used for any other programs that are not installed in the system directories.
BUT ... if your target program needs to run additional executables from the special directory, the above trick won't work. In that case, you can write a shell script that adds to your path as shown in your post, and then executes the required program. Like this:
Code:
#!/bin/bash
export PATH="/home/richard/CodeSourcery/Sourcery_G++_Lite/bin:${PATH}"
(name of program to be executed)
Put the above in a conveniently named script (scriptname.sh), give it executable permissions, and execute it whenever you want to run the special programming environment.