Click to See Complete Forum and Search --> : Running executables?


gorgl
07-29-2001, 05:12 PM
I have an account on a Linux box at university. I wanted to learn to program in C so I experimented a little. I wrote a few programs and compiled them..that went allright. However I have to type ./<program-name> instead of just <program-name> at the prompt to run a program. I've added my programming directory to the PATH environment variable but that didn't help. I use the csh shell and the '.cshrc' config file.

Do you guys know how to fix this?

Thanks in advance.

castlef
07-30-2001, 01:13 AM
im not sure about the C shell but bash all you have to do is add ./ to your path . like export PATH=$PATH:./

castlef
07-30-2001, 01:13 AM
im not sure about the C shell but bash all you have to do is add ./ to your path . like export PATH=$PATH:./

gorgl
07-30-2001, 07:01 AM
I've added the line

set PATH=( ./ $PATH )

to the .cshrc file but the problem isn't solved. I now have another question. How do I change my shell in linux? I would like to try if I can fix the problem with the bash shell.

TheLinuxDuck
07-30-2001, 08:52 AM
It probably didn't work because you've got to supply a colon delimited list to the path variable, and it also has to be exported after it is assigned, as:


PATH="$PATH:."
export PATH


If you are going to do this, it is best to add the "current directory" to the end of the list, not the beginning.

I would strongly advise that you do not add it to your path. Typing ./ when executing a binary from it's current directory (when not in the path) is very common. In fact, it's a part of the way that *nix works.

It's only two characters, anyway.. (^=