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