Q:

Usage of wait system call in unix

I am a bit confused about the syntax of wait. In Wikipedia it is given that the syntax of wait is wait [pid] whereas in the man page it is given that the syntax is pid_t wait(int *status). I had an impression that we cannot call wait with the pid of a process and we needed to use waitpid for that. Could anyone please clear my doubt. Links to both the articles are given below:

Wikipedia article on Wait (command).
Wikipedia article on Wait (system call).
Unix man page on wait (system call).

A:

You're confusing the wait command in the shell with the similar functions used in programming. The shell uses one name, and decides what to do based on how it's used.
If you use the wait command with no arguments, it calls wait() to wait for any child to exit.
If you use the wait command with an argument, it calls waitpid() to wait for that specific PID to exit.

