Date: Sun, 14 May 2000 13:52:20 +0100 From: Ben Smithurst <ben@scientia.demon.co.uk> To: Alex Kwan <alexkwan@pacific.net.hk> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: A basic question about C programming Message-ID: <20000514135220.O10128@strontium.scientia.demon.co.uk> In-Reply-To: <000701bfbd9b$fd945300$591e40ca@alexkwan> References: <000701bfbd9b$fd945300$591e40ca@alexkwan>
next in thread | previous in thread | raw e-mail | index | archive | help
Alex Kwan wrote:
> I am learning C programming with FreeBSD, I write a simple C program
> (filename: inform.c) as follow:
> #include <stdio.h>
> main()
> {
> printf("A .c is used to end a C program filename.\n");
> }
>
> I compile it with "cc -o inform inform.c", when the compilation is
> finished,
> I have got the file "inform", but it can't execute and got the error
> "inform: Command not found", What is the problem of me?
As the other answer said, use ./inform. The reason for this is that
by default most Unix systems do not look in the current directory for
program files. If they did, that could be a security problem. Imagine
you were running as root, and someone placed a script called "ls" in
/tmp which deleted every file on your disk, and without knowing about
this, you did
# cd /tmp
# ls
oops. This can be avoided partly by putting "." at the end of your PATH
so it's checked last, but they could still anticipate typos and put a
script called "sl" there instead.
--
Ben Smithurst / ben@scientia.demon.co.uk / PGP: 0x99392F7D
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000514135220.O10128>
