Next | Unix Command Internals | 12 |
Then the shell execs /bin/ps
ps just writes to its standard output as before, but now the data goes into the file
But ps doesn't have to know or care
The shell does it all
This is how pipes are set up also
For ps | grep the shell forks twice
It tampers with the open file tables before execing ps and grep
ps and grep don't have to know or to care
inetd pulls a similar trick to attach a process's standard input and output to a network socket
Next | Copyright © 2003 M. J. Dominus |