Pregunta

I just installed GMT4 (Generic Mapping Tools) from MacPorts and have run into some serious issues with terminal... When using the ls command in terminal I get the following:

-bash: ls: command not found

To fix this I've tried many things that I read many different places online. I've changed the following files to include /usr and /bin:

~/.bashrc
~/.bash_profile
~/.profile

Doing so gave me back the sudo command which I had previously lost. However, I still am not able to use ls in a new terminal window without manually exporting the path("new session"). This has been causing problems when I'm running shell scripts that use system functions. So I'm starting to wonder what exactly those three files do and if maybe having three files doing the same thing is causing them to interfere with one another. If anyone can tell me where I need to add these PATHS that would be great; I dunno, maybe I can delete one of these files or something ELSE is conflicting. Right now I just run " export PATH=$PATH:/usr" in each new terminal window and it works for that session.

I'm running Mac OS X 10.6 on a early 2011 MacBook Pro with 4GB of RAM.

Background for those who are interested: My end goal is to use Relax to model viscoelastic relaxation in a mid-oceanic ridge system to come up with some sort of constitutive law or power-relation between slip magnitude and the location of greatest tensional stress in the lithosphere due to normal faulting.

¿Fue útil?

Solución

The Bash manual actually explains these files fairly thoroughly. However, the manual does not describe how these mechanisms are usually used in practice. What follows is a brief, abridged version of what is common best practice.

.profile is read at login by both sh and bash.

.bashrc is read by non-login Bash shells. By convention, .bash_profile sources .bashrc in turn.

.bash_profile is read at login by Bash. If this file exists, .profile is not read. By convention, .bash_profile should source .profile if it exists.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top