大家晚安
我有一段code
exe_command(cmd); //cmd 做 sed -i /server/d /etc/ntp.conf
...
...
...
exe_command(cmd) //cmd 做 echo server xxxx.xxx.xxx >> /etc/ntp.conf
用测试程式执行一两次发现 ntp.conf 经常是空的,把前面 command 删除则正常加入
但前面的command要保留不能删除
看进去
exe_command:
   pid = fork();
   if(pid < 0) {}
   else if(pid > 0) {
       wait(&staus);        //