qfedu-linux-advanced-level/day3/d8.c

15 lines
301 B
C
Raw Permalink Normal View History

2023-08-17 09:20:18 +08:00
#include <stdio.h>
#include <unistd.h>
int main()
{
// 环境变量动态设置,用于 d7 的读取
char *env[] = {"JAVA_HOME=/opt/java", "PYTHON_HOME=/opt/python", NULL};
int ret = execle("./d7", "d7", NULL, env);
if (ret == -1)
{
perror("./d7");
}
return 0;
}