Click to See Complete Forum and Search --> : Quick question


Zappo
07-19-2001, 05:52 AM
I've just compiled a program and I've got an a.out in the current directory; when I type 'a.out' at the command prompt, I get a 'command not found' unless I specify the entire path.

How do I get Linux to look in the current directory for a command to execute?

Thanks.

Keyser Soze
07-19-2001, 06:00 AM
a.out is not a standard executable I think, you could make it one I suppose by modifying the permissions, in which case you would either type the complete pathname(which is what it is telling you, a.out is not in the path) or from the directory type ./a.out

Domin
07-19-2001, 06:05 AM
./a.out should work fine. And (I presume you're using gcc/g++) adding -o <filename> you can call it whatever you want (don't wanna have to make a new directory for every small program of yours).

Zappo
07-19-2001, 06:12 AM
Yes, yes, but it's not the name of the executable the trouble. If I call it whatever, it's just the same. I want to be able to type 'programname' and have it executed, when programname is in the current directory.

Nalle
07-19-2001, 06:44 AM
You can never do that, unless current directory also is in the path.

Linux does not search current directory, only path, so the syntax would have to be './progname' to run a program in current directory.


</nalle>

bdg1983
07-19-2001, 06:51 AM
echo $PATH to find out what your current paths are and either move the file into one of those directories or add the directory that contains the file to $PATH.