Quote:
Originally posted by Infernal211283
I was going through a list of commands and i saw a command "source"
if i understand correctly it executes commands from files, so i had to try it..
i created a file with a basic loop with c programming, it is very basic:
int a=0, b=5;
while(b>0)
{
a++;
b--;
printf("%d",a);
}
but it wont run... i tried to add the "#include"s and "void main ()" but it didn't change anything...
so i want to know if:
1) source command is running C programming language?
2) is it possible to just create a file with vim and "source" run it or do i have to use some special compiler?
Thank you.
|
did you have a look at man source?
the way source it typically used is to "reread" scripts, like if you changed something in your /etc/profile and wanted it to take effect right away you would do:
source /etc/profile
to reread the profile and apply the changes. It will not do what you're trying to do above. the only way to run C code is compiling ( since c code starts before main, something has to put the initialization code in the executable and thats where the compiler comes in).