I understood your question, but in my opinion your approach is wrong.
I can not see your image and you also did not mention the programming language, but this was already my doubt and I will register here an answer for anyone who might be interested if the language is C or C ++.
You can not create scripts in executables, if you use system calls to execute commands directly.
For this there are some alternatives, the simplest is to use within the executable a call to system()
.
A common example would be:
#include <stdlib.h>
int main (int argc, char *argv[])
{
system(argv[1]);
return 0;
}
Try passing some argument to the executable, for example:
./binario "ls -l"
There are also other calls that do this with the use of popen()
and pclose()
, they depend only on stdio.h
.