Sachin
Sachin

Reputation: 21921

$$ in KornShell

What is the meaning of $$ in KornShell? I guess it is associated with the process ID, but I want to know its exact meaning.

Upvotes: 8

Views: 4570

Answers (2)

martin clayton
martin clayton

Reputation: 78155

$$ is the process id of the ksh process itself; $PPID is the process id of its parent.

Here's the ksh (93) documentation for special parameters (it's after the fold). Same info for ksh88.

Upvotes: 6

Philip Schlump
Philip Schlump

Reputation: 3144

It is used for making temporary names with the process id. Say you need a file name but that name needs to be unique to the process you are in - so if more than one person runs the same ksh script they will not step on each other.

$$ is in bash, sh and other UN*X shells.

Upvotes: 2

Related Questions