Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I know this is a lame question and I've been told to not ask questions here that aren't worth you're guys' time, but I need a quick answer, I've ...
  1. #1
    Just Joined!
    Join Date
    Sep 2009
    Posts
    5

    program won't run in bash

    Hi,

    I know this is a lame question and I've been told to not ask questions here that aren't worth you're guys' time, but I need a quick answer, I've scoured the internet and can't find the answer even though I'm sure it's out there.

    Bash won't execute my programs or even recognize them. I wrote a simple program to test out and it won't work. I'm doing the following:

    gcc -o hello hello.c

    and that's fine. but when I type "hello" after that to run the program, I get an error saying "command not found".

    All the permissions for my files are fine, I have rwx permissions on them all. I'm sure it's a simple fix, but I can't figure out what it is. I would SO appreciate any help anyone might have to offer.

    Thanks,
    Ashley

  2. #2
    Just Joined!
    Join Date
    Sep 2009
    Posts
    2
    try running ./hello

  3. #3
    Linux Enthusiast
    Join Date
    Aug 2006
    Location
    Portsmouth, UK
    Posts
    539
    bash uses the PATH environment variable to look for commands (executables). Where ever hello is, it's probably not on the PATH so as kday has said use ./hello

    The ./ tells bash to look in the current directory.
    RHCE #100-015-395
    Please don't PM me with questions as no reply may offend, that's what the forums are for.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...