Hi there!! 

On Sun, 2 Aug 1998, Anukool Lakhina wrote:

[snipsnip]

> error message I get is "a.out: Command not found." But ls tells me that

Try running a.out like this:

$ ./a.out

It appears as though your path doesn't include the current directory 
(otherwise known as "."), and by default most Unix shells don't search 
the current dir, which is actually a Good Thing because it prevents some 
Trojan Horses sometimes...

Some *other*, significantly less secure as well as robust and lacking in 
a good deal of other nifty things Unix does very well, search the current
directory *before* anything else, and as far as I know you can't change 
that behavior without somehow obtaining an alternative to the shell 
provided, which, compared to Unix shells, is really somewhat of a disgrace.

But, I'm quite sorry, I digress rather badly! Say, if you don't want to 
type "./a.out" and instead prefer the easier and quicker "a.out", you 
can, if you're using a Bourne-style shell (usually indicated via a "$" 
somewhere in your prompt), add the following lines to your .profile:

PATH=$PATH:.
export PATH

Or, if you're using a C-style sort of shell, the following line (to your 
.login or .cshrc or whatnot) should do just fine:

set path = ( $path . )

And then you can say:

foo> gcc foo.c
foo> a.out

But it's generally recommended you not put "." anywhere in the path of 
root, should have you access to root, because of those trojan horses you 
hear about from time to time...

Anyway, have a nice day, hope this was helpful somehow. :)

Long Live Linux!!
-Brett

Reply via email to