2006-10-31 23:23:16 +08:00
|
|
|
\section psub psub - perform process substitution
|
2005-10-21 20:39:45 +08:00
|
|
|
|
|
|
|
\subsection psub-synopsis Synopsis
|
2007-01-16 02:19:24 +08:00
|
|
|
<tt>COMMAND1 (COMMAND2|psub [-f]) </tt>
|
2005-10-21 20:39:45 +08:00
|
|
|
|
|
|
|
\subsection psub-description Description
|
|
|
|
|
|
|
|
Posix shells 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
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
program. \c psub combined with a
|
2005-10-21 20:39:45 +08:00
|
|
|
regular command substitution provides the same functionality.
|
|
|
|
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
If the \c -f or \c --file switch is given to <tt>psub</tt>, \c psub will use a
|
2007-01-16 02:19:24 +08:00
|
|
|
regular file instead of a named pipe to communicate with the calling
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
process. This will cause \c psub to be significantly slower when large
|
2007-01-16 02:19:24 +08:00
|
|
|
amounts of data are involved, but has the advantage that the reading
|
|
|
|
process can seek in the stream.
|
|
|
|
|
2005-10-21 20:39:45 +08:00
|
|
|
\subsection psub-example Example
|
|
|
|
|
|
|
|
<tt>diff (sort a.txt|psub) (sort b.txt|psub)</tt> shows the difference
|
|
|
|
between the sorted versions of files a.txt and b.txt.
|