パイプの並列対応をするかどうか、、?
Closed this issue · 4 comments
kefujiwa commented
パイプの並列対応をするかどうか、、?
tkomatsu commented
SHELL GRAMMAR
Simple Commands
A simple command is a sequence of optional variable assignments followed by blank-separated words and redirections, and terminated by a
control operator. The first word specifies the command to be executed, and is passed as argument zero. The remaining words are passed
as arguments to the invoked command.
The return value of a simple command is its exit status, or 128+n if the command is terminated by signal n.
Pipelines
A pipeline is a sequence of one or more commands separated by one of the control operators | or |&. The format for a pipeline is:
[time [-p]] [ ! ] command [ [|||&] command2 ... ]
The standard output of command is connected via a pipe to the standard input of command2. This connection is performed before any
redirections specified by the command (see REDIRECTION below). If |& is used, command's standard error, in addition to its standard
output, is connected to command2's standard input through the pipe; it is shorthand for 2>&1 |. This implicit redirection of the stan-
dard error to the standard output is performed after any redirections specified by the command.
The return status of a pipeline is the exit status of the last command, unless the pipefail option is enabled. If pipefail is enabled,
the pipeline's return status is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands exit
successfully. If the reserved word ! precedes a pipeline, the exit status of that pipeline is the logical negation of the exit status
as described above. The shell waits for all commands in the pipeline to terminate before returning a value.
If the time reserved word precedes a pipeline, the elapsed as well as user and system time consumed by its execution are reported when
the pipeline terminates. The -p option changes the output format to that specified by POSIX. When the shell is in posix mode, it does
not recognize time as a reserved word if the next token begins with a `-'. The TIMEFORMAT variable may be set to a format string that
specifies how the timing information should be displayed; see the description of TIMEFORMAT under Shell Variables below.
When the shell is in posix mode, time may be followed by a newline. In this case, the shell displays the total user and system time
consumed by the shell and its children. The TIMEFORMAT variable may be used to specify the format of the time information.
Each command in a pipeline is executed as a separate process (i.e., in a subshell). See COMMAND EXECUTION ENVIRONMENT for a descrip-
tion of a subshell environment. If the lastpipe option is enabled using the shopt builtin (see the description of shopt below), the
last element of a pipeline may be run by the shell process.
tkomatsu commented
tkomatsu commented
これらで標準の仕様として定められているわけではないので、minishellの仕様として順番に処理していますという回答でいいのでは。
kefujiwa commented
結論として、minishellの仕様で行きます!
よって、本件クローズします。