Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$$ in KornShell

Tags:

shell

ksh

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

like image 853
Sachin Chourasiya Avatar asked Dec 04 '09 12:12

Sachin Chourasiya


People also ask

What is $$ in ksh?

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

Is Korn shell still used?

The Korn shell (either ksh88 or ksh93, depending on the age of the system) is a standard part of any modern (commercial) Unix system, e.g. Solaris, AIX, HP-UX. pdksh is often available on BSD or GNU/Linux systems, and a growing number of GNU/Linux systems now offer ksh93, either instead of or in addition to pdksh.

What does ksh mean in Linux?

Description. The ksh command invokes the Korn shell, which is an interactive command interpreter and a command programming language. The shell carries out commands either interactively from a terminal keyboard or from a file.

How do I compare strings in ksh?

To compare strings one uses "=" for equal and "!= " for not equal. and "-lt" for less than.


2 Answers

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

like image 51
martin clayton Avatar answered Oct 01 '22 21:10

martin clayton


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.

like image 39
Philip Schlump Avatar answered Oct 01 '22 21:10

Philip Schlump