[cs631apue] Does $$ represents the shell's pid or the current process's pid?

Shicong Huang shuang14 at stevens.edu
Thu Dec 17 22:02:18 EST 2015


Hi professor,

The instruction said "$$ The current process ID.". But it seems bash always
treats $$ as the process id of itself. Consider the following commands:

         bash$ ls -l | echo $$
         bash$ echo $$

They all print the shell's process id.
So, what should we do?

Thanks!

Shicong Huang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20151217/5854b6f5/attachment.html>


More information about the cs631apue mailing list