| 1 |
'\" |
| 2 |
'\" Copyright (c) 1993 The Regents of the University of California. |
| 3 |
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 4 |
'\" |
| 5 |
'\" See the file "license.terms" for information on usage and redistribution |
| 6 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 7 |
'\" |
| 8 |
.TH pid n 7.0 Tcl "Tcl Built-In Commands" |
| 9 |
.so man.macros |
| 10 |
.BS |
| 11 |
'\" Note: do not modify the .SH NAME line immediately below! |
| 12 |
.SH NAME |
| 13 |
pid \- Retrieve process identifiers |
| 14 |
.SH SYNOPSIS |
| 15 |
\fBpid \fR?\fIfileId\fR? |
| 16 |
.BE |
| 17 |
|
| 18 |
.SH DESCRIPTION |
| 19 |
.PP |
| 20 |
If the \fIfileId\fR argument is given then it should normally |
| 21 |
refer to a process pipeline created with the \fBopen\fR command. |
| 22 |
In this case the \fBpid\fR command will return a list whose elements |
| 23 |
are the process identifiers of all the processes in the pipeline, |
| 24 |
in order. |
| 25 |
The list will be empty if \fIfileId\fR refers to an open file |
| 26 |
that is not a process pipeline. |
| 27 |
If no \fIfileId\fR argument is given then \fBpid\fR returns the process |
| 28 |
identifier of the current process. |
| 29 |
All process identifiers are returned as decimal strings. |
| 30 |
.SH EXAMPLE |
| 31 |
Print process information about the processes in a pipeline using the |
| 32 |
SysV \fBps\fR program before reading the output of that pipeline: |
| 33 |
.PP |
| 34 |
.CS |
| 35 |
set pipeline [open "| zcat somefile.gz | grep foobar | sort -u"] |
| 36 |
# Print process information |
| 37 |
exec ps -fp [\fBpid\fR $pipeline] >@stdout |
| 38 |
# Print a separator and then the output of the pipeline |
| 39 |
puts [string repeat - 70] |
| 40 |
puts [read $pipeline] |
| 41 |
close $pipeline |
| 42 |
.CE |
| 43 |
|
| 44 |
.SH "SEE ALSO" |
| 45 |
exec(n), open(n) |
| 46 |
|
| 47 |
.SH KEYWORDS |
| 48 |
file, pipeline, process identifier |