seemingly dumb-ass question

David Korn dkorn@pixelpower.com
Fri Feb 16 05:43:00 GMT 2001


>-----Original Message-----
>From: Gareth Clark [ mailto:balloonbending@yahoo.com ]
>Sent: 16 February 2001 13:21

>This is probably very easily answered but when i want
>to run a program which I have compiled with 'gcc
>filename.c -o filename.exe' how do i run it? if i type
>filename.exe i just get 'command not found' back. 
>I am using Red Hat 6.2 with the default version of
>gcc. 

    Hi Gareth,

 It is indeed very easy.  Linux doesn't search the current directory for
programs to be run unless you specifically add it to the path with a line
such as

 export PATH=$PATH:.

or alternatively, you can specify that your executable is in the current
directory when you try to run it by putting ./ in front of the filename

 ./filename.exe

  Of these, it is better to get into the habit of adding ./ to your 
commands, because having the current directory in your path is theoretically
a security risk (if someone could arrange for a trojan version of ls, for
example, to be in one of your directories, you might accidentally run it
when you tried to get a directory listing; if you don't have . in the path
that can't happen).

    cheers, 
        DaveK
-- 
we are not seats or eyeballs or end users or consumers.
we are human beings - and our reach exceeds your grasp.
                    deal with it.                      - cluetrain.org 


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



More information about the Gcc-help mailing list