Search code examples
clinuxprocessexecute

Running multiple C programs from a C program under Linux


I'm trying to learn a bit or 2 about process communication under Linux, so I wrote 2 simple C programs that communicate with each other.

However, it's a bit annoying to have to run them manually every single time, so I'd like to know is there a way to make a program that will run them both, something like this:

./runner program1 program2

I'm using latest Ubuntu and Bash shell.


Solution

  • run.sh script

    #!/bin/sh
    ./program1 & 
    ./program2 &
    

    run command:

    $sh run.sh