2012-05-22 44 views
0

可能重複:
What does $$ mean in the shell?

$ ./cruncher & ./cruncher & ./cruncher & 
$ ps -C cruncher -p $$ -o pid,state,cmd 
PID S CMD 
2588 S bash 
2657 R /bin/sh ./cruncher 
2658 R /bin/sh ./cruncher 
2659 R /bin/sh ./cruncher 

-C cmdlist  Select by command name. 
         This selects the processes whose executable name is 
         given in cmdlist. 

-p pidlist  Select by PID. 
         This selects the processes whose process ID numbers 
         appear in pidlist. 

問題>什麼是$$意思?

+0

[$$指的是運行腳本的bash實例的PID](http://stackoverflow.com/a/78528/391104) – q0987

回答

3

它與ps命令無關,$$被shell替換爲其進程ID爲

1

這是一個內置的shell變量,它保存了PID進程ID。

相關問題