pid(3tcl)
π pid β bestie, who even ARE you (process edition) π
okay so this is a page from the Tcl Built-In Commands manual, and it's called pid. Yes, like process identifier. Yes, it's short. Yes, it's iconic. Let's go β¨
πΈ NAME πΈ
pid β Retrieve process identifiers π«Ά
β¨ SYNOPSIS β¨
pid ?fileId?
π DESCRIPTION π
okay so here's the tea, bestie π
If you hand over the fileId argument, then β and this is the important part β it should normally refer to a process pipeline that got created with the open command. In that case, pid is gonna return a list whose elements are the process identifiers of all the processes in the pipeline, in order. Like, in ORDER order. The way it lines them up?? obsessed. π
And lowkey, if fileId refers to an open file that is not a process pipeline, the list will just be empty. No drama, just vibes. π
But if you don't give a fileId argument at all? Then pid returns the process identifier of the current process. That's you. That's your main character energy right there. π
Oh and β all process identifiers are returned as decimal strings. Not numbers, not vibes, decimal strings. Periodt. π
π EXAMPLE π
So here's how you print process information about the processes in a pipeline using the SysV ps program, before you read the output of that pipeline. Chef's kiss setup fr fr π
set pipeline [open "| zcat somefile.gz | grep foobar | sort -u"]
# Print process information
exec ps -fp [pid $pipeline] >@stdout
# Print a separator and then the output of the pipeline
puts [string repeat - 70]
puts [read $pipeline]
close $pipeline
like?? the way that pipeline just works?? π¦
π SEE ALSO π
π KEYWORDS π
file, pipeline, process identifier
no cap, that's the whole page bestie. short, sweet, and literally does exactly what it says on the tin. iykyk π
and that's a wrap on this lil page from the Tcl manual, version 7.0, dated 7.0 (yes that's what the footer says, don't come for me π). bye bestie, go check on your processes πβ¨
π¦ where this page comes from
- debian trixie: tcl9.0-doc 9.0.1+dfsg-2
- ubuntu questing: tcl9.0-doc 9.0.2+dfsg-1
- ubuntu resolute: tcl9.0-doc 9.0.3+dfsg-1
- ubuntu stonking: tcl9.0-doc 9.0.4+dfsg-1
- Copyright (c) 1993 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms