开发者

What does "$$" means in shell script? [duplicate]

开发者 https://www.devze.com 2022-12-14 02:33 出处:网络
This question already has answers here: 开发者_C百科 What does $$ mean in the shell? (12 answers) Closed 8 years ago.
This question already has answers here: 开发者_C百科 What does $$ mean in the shell? (12 answers) Closed 8 years ago.

I came across "$$" expression in shell script, something like this

TFILE=$$

Can anyone tell me its meaning?


$$ means the process ID of the currently-running process.


It's the process id of the current process - see a previous question on StackOverflow for details: What does $$ mean in the shell?


$$ is the process id of the currently running process in UNIX.

mostly it is used with naming of logfiles aor temp files, such that there is no conflict of file names while multiple instances of the same scripts are running.


echo "$$" prints PID of current running process.

0

精彩评论

暂无评论...
验证码 换一张
取 消