[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lastpipe and "*may* be run by the shell process"
From: |
Andreas Kusalananda Kähäri |
Subject: |
lastpipe and "*may* be run by the shell process" |
Date: |
Mon, 11 May 2020 21:15:51 +0200 |
Hi,
I was recently answering a bash-related query in another context, and
found myself quoting the bash (5.0.17(1)-release) manual:
Each command in a pipeline is executed as a separate
process (i.e., in a subshell). See COMMAND EXECUTION
ENVIRONMENT for a description 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.
What caught my eye was the word "may" in the last sentence, and it
struck me that I couldn't immediately think of a case where this word
couldn't be "will" instead. That is to say, where setting the lastpipe
shell option did *not* cause the last part of a pipeline to run in the
invoking shell environment.
Not usually using lastpipe myself, it's possible that I just haven't
come across instances where it doesn't work as naively expected. Does
anyone have examples of where the last part of the pipeline does not run
in the invoking shell environment, even when lastpipe is set?
--
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden
.
- lastpipe and "*may* be run by the shell process",
Andreas Kusalananda Kähäri <=