TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALISTER
from: MARTIN GREGORIE
date: 2018-07-05 15:21:00
subject: Re: a.out problem

On Thu, 05 Jul 2018 15:02:16 +0000, Alister wrote:

> On Thu, 05 Jul 2018 15:43:27 +0100, Peter Percival wrote:
>
>> Jan Panteltje wrote:
>>> On a sunny day (Thu, 5 Jul 2018 14:22:06 +0100) it happened Peter
>>> Percival  wrote in
>>> :
>>>
>>>> I wrote a "Hello world" program in C.
>>>>
>>>> gcc hello.c
>>>>
>>>> creates a.out without warnings or error messages.  ls shows that
>>>> a.out exists.
>>>>
>>>> a.out
>>>>
>>>> gets the response
>>>>
>>>> -bash: a.out: command not found
>>>
>>> Try ./aout
>>>
>>> For compile, better use gcc -Wall -o hello hello.c
>>>
>>> ./hello
>>>
>>>
>> Thank you.  I have added . to PATH and it now works.
> please reconsider that approach carefully, it opens up a bunch of
> potential security risks

Its not unreasonable to do that in a development directory, but two
caveats:

1) do make sure that the '.' is the last item in PATH or you may wonder
   why a standard program no longer works

2) If you want to make a program or script you've written available in
   more than one directory, put it in /usr/local/bin, *NOT* /bin or
   /usr/bin and make sure /usr/local/bin is immediately in front of
   '.' at the end of $PATH

   and make sure that its access permissions are rwxr-xr-x, i.e. only you
   can overwrite or erase it but everybody has read and execute
   permissions.

   Putting it in /usr/local/bin makes sure that it can't get overwritten
   by a new, shiny system program that appears in a system update.


--
Martin    | martin at
Gregorie  | gregorie dot org

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.