Root or Cling and Bash scripting

I wanted to create an executable, that i can call in a bash script, with c++ code, which when i run the bash scripts will interprete the c++ code, how can i achieved that.
Bash scripts will look like

#! /usr/local/bin/test_executable

int main ( int argc, char *argv[] )
    cout << " SUCCESSFUL" << endl;

  exit ( 0 );

Welcome to the ROOT forum.

You can create the .C macro mymacro.C and in your shell script you do:

root -l -b -q maymacro.C

The goal is to create a c++ executable, by linking so many files and call this executable in the bash or shell scripts which will allow me to execute the c++ code in the scripts

Simply create the executable and call it from the the shell script. Ie:

You put the C++ code into a file test_executable.cxx, then you compile and link it. You will get an executable test_executable, and you call it for the script.