beginner a.out question.

Claudio Bley bley@mail.cs.uni-magdeburg.de
Mon Aug 27 14:03:00 GMT 2001


>>>>> "Phil" == Phil Taylor <phil@advancedarchitecture.org> writes:

    Phil> Background: new installation of redhat 7.1 on pentium 90. In
    Phil> bash.  When trying to compile beginner C source code (hello.c) I
    Phil> get an output "a.out" that will not run.

    Phil> xxxxxxxcommandlinequotationsxxxxxxxxxx

    Phil> [phil@localhost dir]a.out bash: a.out: command not found

    Phil> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    Phil> I do not understand my problem here: the command is right there
    Phil> in the directory ("ls" = a.out and other files).  

Cool, but your current directory is not in the PATH and BASH simply can't
find the executable, which is exactly what it (bash!) told you.

You need to specify either the full qualified path, specify a relative path
or add the current directory to the PATH variable (see below).

1) $ ./a.out
2) $ /home/playground/a.out

3) $ PATH="$PATH:."
   $ a.out

But be aware that the third method can be considered a security problem if
you add it to a shell init file, because a user could easily add a program
called e.g. 'cd' (like the well known shell command) to a public directory
which will wipe out all the files in your home directory if you enter the
directory and intend to leave it with e.g. "cd ..".

    [...]
    Phil> Sincerely, Phil

    Phil> (thank you, and my apologies if this msg. is inappropriate.)

well, slightly ...

Claudio



More information about the Gcc-help mailing list