I would like to make a script for testing my c program but I could not figure out why it does not work I tested it with a easy code so that I am sure that the problem is not because of the C file.
My C Code is:
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello World\n");
return 0;
}
And my Shell Script is:
gcc -o main main.c
echo "Hello world"
If I execute the script I get the error message on my console
: No such file or directory
gcc: fatal error: no input files
compilation terminated
This is the Error I get if I want to execute the script
https://i.sstatic.net/SP6Qr.jpg
In the image you can see my problem
If I compile the C file “per hand” it has no problem but if I execute the script which contains the same statement it does not work.
If I just want to compile and only write the command for compiling in my script it works but as soon as I ad an echo or any other command it will not work.
I am using an Ubuntu Shell under Windows.
Any help would be very appreciated.