在Linux下从一个C程序运行多个C程序 [英] Running multiple C programs from a C program under Linux

查看:65
本文介绍了在Linux下从一个C程序运行多个C程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图学习有关Linux下进程通信的知识,所以我写了2个相互通信的简单C程序.

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

我正在使用最新的Ubuntu和Bash shell.

I'm using latest Ubuntu and Bash shell.

推荐答案

run.sh脚本

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

运行命令:

$sh run.sh

这篇关于在Linux下从一个C程序运行多个C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆