can not execute a C script call "if"
Hi,
I am using Ubuntu 7.04. I am starting to test C on Linux and something I do not really understand has happened. I created this simple script called "if.c": #include <stdio.h> int main(void) { int test = 1; if (test) { printf ("*** Value of the test is %d.\n", test); } return 0; } So, the thing is... 1) If I compile it and name it "if": $ gcc -g -o if if.c If compiles OK, but when I execute it: $ if > It doesn't run. I need to stop it with ctrl+c. 2) However, if I compile it with another name: $ gcc -g -o maybe if.c It does run!!! $ maybe *** Value of the test is 1. Somebody knows what's going on? Is there any conflict with using "if" as the name? |
Quote:
Code:
./if |
Quote:
Code:
$ if |
What everyone is telling you:
1. You created a compiled program that is named the same thing as a word in bash. Bash is your shell language. 2. Code:
which if 3. putting ./ in front of a filename means "use the current working directory" to find the file. |
All times are GMT -5. The time now is 07:41 PM. |