What’s the syntax to add a directory to my path search for calling executables from the command line? (I think this would be a mod for .bashrc and .tcshrc)
Thank You!
PattiM
What’s the syntax to add a directory to my path search for calling executables from the command line? (I think this would be a mod for .bashrc and .tcshrc)
Thank You!
PattiM
Unless you specifically use csh or tcsh for something you should only have to change it for .bashrc
The syntax to add to the .bashrc file would be like this
export PATH=$PATH:/new/path:/another/new/path:.
the $PATH means add to the already given path, and new entries are separated by a colon. The dot at the end adds the current working directory also to the path.
If you wish to also add it for the csh, you can add the following to .cshrc (or .tcshrc, doesn’t matter which)
set path = ( $path /new/path /another/path .)
Hope this helps.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
export PATH=$PATH:/path/to/new/directory
You can put this line, with the directory of your choice on the end, in
~/.bashrc or ~/.profile, yes. Also be sure you never put the current
directory in there as ‘.’ as that’s a bit of a security no-no.
Good luck.
PattiMichelle wrote:
> What’s the syntax to add a directory to my path search for calling
> executables from the command line? (I think this would be a mod for
> .bashrc and .tcshrc)
>
> Thank You!
> PattiM
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFI1ueY3s42bA80+9kRAtF2AJ42yMQPgZRWLw5sshQ4UfHoU7HbqwCfV5nU
e8muwAWD/M8VS0gfU0T3uGA=
=BSSJ
-----END PGP SIGNATURE-----
Seems safe to me, as long as you put it LAST,
as the previous poster shows.
Thank you very much!! I use bash, of course, but I also have to use tcsh from time to time to run some special software I have. I have installed some software from the openSuSE repo (openMPI), but it created all the files in a bin subdirectory without making any links to /usr/local/bin (or any other default directory on the path). So I’m just going to add the path
Pattilol!
If you are compiling stuff for MPI, keep in mind that you may also have to add the libraries to the library path. The environment variable you want to change in this case is
LD_LIBRARY_PATH
So, for example on my system (64 bit and using Intel MPI instead of openMPI)
export LD_LIBRARY_PATH="/opt/intel/mpi/3.0/lib64:$LD_LIBRARY_PATH"
Yours will probably be in a different location.
all of that is true, but also if you install a new library, you need
to run ldconfig to rescan the libraries. it makes a giant ‘hash
table’ which lets linux link libraries faster during compiling
–
DenverD (Linux Counter 282315) via NNTP, Thunderbird 2.0.0.14, KDE
3.5.7, SUSE Linux 10.3, 2.6.22.18-0.2-default #1 SMP i686 athlon
I just wanted to say, again, a big THANK YOU!!! I was really confused by the need to set LD_LIBRARY_PATH - but once I did this, it seems to work fine. I also wasn’t sure if starting tcsh under bash would pick up the LD_LIBRARY_PATH, and I don’t know enough linux command-line to trouble-shoot path variable problems. But it did pick it up so YAY!!!
To set this as a system wide path for all and everyone… would the correct thing be to create a profile.local in /etc?