.\" Man page generated from reStructuredText
.\" by the Docutils 0.22.4 manpage writer.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "PSUB" "1" "Mar 28, 2026" "4.6" "fish-shell"
.SH NAME
psub \- perform process substitution
.SH SYNOPSIS
.nf
\fICOMMAND1\fP ( \fICOMMAND2\fP | \fBpsub\fP [\fB\-F\fP | \fB\-\-fifo\fP] [\fB\-f\fP | \fB\-\-file\fP] [(\fB\-s\fP | \fB\-\-suffix\fP) \fISUFFIX\fP] )
.fi
.sp
.SH DESCRIPTION
.sp
Some shells (e.g., ksh, bash) feature a syntax that is a mix between command substitution and piping, called process substitution. It is used to send the output of a command into the calling command, much like command substitution, but with the difference that the output is not sent through commandline arguments but through a named pipe, with the filename of the named pipe sent as an argument to the calling program. \fBpsub\fP combined with a regular command substitution provides the same functionality.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-f\fP or \fB\-\-file\fP
Use a regular file instead of a named pipe to communicate with the calling process. This will cause \fBpsub\fP to be significantly slower when large amounts of data are involved, but has the advantage that the reading process can seek in the stream. This is the default.
.TP
\fB\-F\fP or \fB\-\-fifo\fP
Use a named pipe rather than a file. You should only use this if the command produces no more than 8 KiB of output. The limit on the amount of data a FIFO can buffer varies with the OS but is typically 8 KiB, 16 KiB or 64 KiB. If you use this option and the command on the left of the psub pipeline produces more output a deadlock is likely to occur.
.TP
\fB\-s\fP or \fB\-\-suffix\fP \fISUFFIX\fP
Append SUFFIX to the filename.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SH EXAMPLE
.INDENT 0.0
.INDENT 3.5
.sp
.EX
diff (sort a.txt | psub) (sort b.txt | psub)
# shows the difference between the sorted versions of files \(ga\(gaa.txt\(ga\(ga and \(ga\(gab.txt\(ga\(ga.

source\-highlight \-f esc (cpp main.c | psub \-f \-s .c)
# highlights \(ga\(gamain.c\(ga\(ga after preprocessing as a C source.
.EE
.UNINDENT
.UNINDENT
.SH Copyright
fish-shell developers
.\" End of generated man page.
