Can't run compiled c files that are not in /bin/ or /usr/bin/

I recently installed Mandrake 10.1 and from my experience I should be able to execute compiled c files from a shell by just typing ./program_name but this doesn't work. The error I get is command not found. I set the permissions to 777 on the directory that contains the file and the file that I was trying to execute.  I can run the compiled c file when I copy it to the /bin/ or /usr/bin/ folders but not in other folders.  I've also tried running the file as root and it still doesn't work.  Does anyone know how I can get files to execute from any folder.

Thanks in advance.

Chaileor
ChaileorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

marxyCommented:
Show report of
ls -lA ./program_name

Most of cases, ./program_name has insufficient permissions.
To be run it has to set +x permissions, btw.
0
gtkfreakCommented:
Ensure that the following attributes are on your file:
rwxr-xr-x
To change rights to execute your program:
$ chmod u+rwx file_name

file_name is your compiled C program.
0
ChaileorAuthor Commented:
My permissions are all fine.   The attributes on my file are rwxrwxrwx.  I also set them to rwxrwxrwx on the directory containing the file just to be safe.  I thought there would be a simple solution to this but I can't seem to find an answer so I think that an answer to this is worth more points than I had originally set.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

surya_prabhakarCommented:
can you give the output of

# echo $PATH
please ....


surya.
0
ChaileorAuthor Commented:
This is the output from # echo $PATH:
/usr/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/:/usr/games:/home/jeff/bin

I hope this helps.

Chaileor
0
mike_mianCommented:
as you are typing ./progname your path is not used.
does your program make any system calls to other programs? you may be getting an error from a call it is making.
are you doinf any setuid in the program or is it a simple "hello world" prog?


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
surya_prabhakarCommented:
is your program in the directory /home/jeff/bin??

if so try the below
unset PATH
PATH=/usr/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/:/usr/games
export PATH

then run your program  with ./whatever-is-the-name

surya.

0
ChaileorAuthor Commented:
Thanks mike_mian, I just needed to add ./ to my path variable and now everything runs great.  To permanently add that to my path I just edited /etc/profile and added the line

export PATH=$PATH:./

Chaileor
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.