PDA

View Full Version : running a program



task
04-24-2002, 02:51 PM
I am currently learning 'C' and wish to test my programs but when I try to run it its not working. Why is this?

e.g. Lets say the famous hello program. if a compile it then try to run it it just gives me a message command not found.

user:$ gcc -o hello hello.c
user:$ hello
error hello:bash command not found
user:$

Salem
04-24-2002, 03:01 PM
The current directory is not in your path

So type
./hello

Lynux-Penguin
04-26-2002, 06:09 PM
when you get into programs you may want to keep for universal or personal use put them in either
/usr/local/bin
or
/home/[username]/bin

put it in the top one if you wish for anyone to use it
put it in your own bin if you want to be the only one available to it command-line wise
lets say I created a program called tax.c
here is what I would do to allow myself and only myself to use it
[user@machine folder]$ gcc tax.c -o tax
[ compile ]
[user@machine folder]$ chmod 760 tax; mv tax /home/user/bin
[ to execute: ]
[user@machine folder]$ tax
[ Program initiated ]