Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何将jobs命令作为shell内置实现?_C++_Shell - Fatal编程技术网

C++ 如何将jobs命令作为shell内置实现?

C++ 如何将jobs命令作为shell内置实现?,c++,shell,C++,Shell,我试图实现shell内置命令来获取当前作业及其状态的列表,因此shell输出如下内容 JID STATUS COMMAND 1137 Stopped less & 2245 Running cat /dev/urandom | less & 2343 Running ./jobcontrol & 最好使用waitpid获取状态。如何从fork跟踪多个子作业ID

我试图实现shell内置命令来获取当前作业及其状态的列表,因此shell输出如下内容

JID  STATUS  COMMAND
1137 Stopped less &
2245 Running cat /dev/urandom | less &
2343 Running ./jobcontrol &
最好使用waitpid获取状态。如何从fork跟踪多个子作业ID