0% found this document useful (0 votes)
14 views

2.5.H-Compilation and Execution of A C Program

The document describes a C program called debug.sh that continuously compiles and executes a C source code file. The debug.sh program compiles the source code file into an executable, checks for errors, executes the program if no errors, or edits the source file if errors occur. It then repeats this process indefinitely. When run with a sample source code file called samp.c, it produced compiler warnings about a multi-line string and missing quote, before successfully executing and printing "Hello".
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

2.5.H-Compilation and Execution of A C Program

The document describes a C program called debug.sh that continuously compiles and executes a C source code file. The debug.sh program compiles the source code file into an executable, checks for errors, executes the program if no errors, or edits the source file if errors occur. It then repeats this process indefinitely. When run with a sample source code file called samp.c, it produced compiler warnings about a multi-line string and missing quote, before successfully executing and printing "Hello".
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

2.5.HCompilation and execution of a C program Program (debug.sh) # Compile and execute while true do gcc -o $1.out $1.

c case "$?" in 0)echo "Executing ..." ./$1.o ut exit;; *) sleep 5 vi $1.c esac done Output [1031@CPII ~]$ sh debug.sh samp samp.c:4:10: warning: multi-line string literals are deprecated samp.c:4:10: missing terminating " character samp.c:4:10: possible start of unterminated string literal samp.c: In function `main': samp.c:4: parse error at end of input Executing ... Hello

You might also like