How to execute a shell script from C in Linux?

后端 未结 6 1960
旧巷少年郎
旧巷少年郎 2020-11-28 03:34

How can I execute a shell script from C in Linux?

6条回答
  •  粉色の甜心
    2020-11-28 04:18

    You can use system:

    system("/usr/local/bin/foo.sh");
    

    This will block while executing it using sh -c, then return the status code.

提交回复
热议问题