10

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

TFILE=$$

Can anyone tell me its meaning?

Vinit Dhatrak
  • 6,814
  • 8
  • 27
  • 30

4 Answers4

24

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

Ether
  • 53,118
  • 13
  • 86
  • 159
5

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

Community
  • 1
  • 1
teapot7
  • 733
  • 1
  • 5
  • 11
1

$$ 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.

Venkataramesh Kommoju
  • 1,053
  • 4
  • 13
  • 19
0

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

Ashitosh
  • 1,652
  • 3
  • 12
  • 11