Compile and run C++ code
It's a good start, but I see a number of things that may help you improve your code.

Try to reduce the scope of variables

The variables o_is_set and found are essentially global variables, but don't need to be.  Instead, the code might be structured as a series of functions, reducing the linkage within the code.

Use standard option parsing

One could use getopts for parsing command line options, or plain old bash for that.  For example, consider this code for parsing a -o option with its corresponding argument:

while [[ $# &gt; 1 ]]
    do
        opt="$1"
        case $opt in 
            -o)
            OUTPUT="$2"
            shift
            ;;
            *)
                # ignore unknown option
            ;;
        esac
        shift
    done


Use make instead

The basic operation of this file is to create an executable from either a .cpp or .c file using the gcc compiler and then running the resulting executable.  One can do essentially the same thing with a single line:

#!/bin/bash 
make $1 &amp;&amp; ./$1


For example, if we have nuts.c in the current working directory and the file above is called car we can execute ./car nuts and make will run, find the nuts.c file, create an executable nuts and then run it.