So, I have this command line I want to execute in C:
ps -eo user,pid,ppid 2> log.txt | grep user 2>>log.txt | sort -nk2 > out.txt
And I need to figure out how I'd make the code... fd What I understand is that I have the father ps... Which needs to redirect the output as an input to the grep, and it also needs to error output to log.txt...
The same with the grep... the output must be redirected to the sort, and the error must be saved in log.txt.
and I'd just output the sort to the file...
Something like this:
FATHER(ps) SON(grep) SON-SON? (sort)
0->must be closed ----> 0 ----> 0
/ /
1 ---------------/ 1 --------/ 1 -->out.txt
2 ---> log.txt 2 ---> log.txt 2 -->nowhere?
But I don't know how this would be coded... I'd appreciate your help.