You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File redirections are not well scoped to an expression #17604
Note that file redirections are scoped to an expression and apply to all external commands in the
expression. In the example below, out.txt will contain hello\nworld:
But only last commands seems redirected
Relate closed issue : #15326
How to reproduce
let text = "hello\nworld"
($text | head -n 1; $text | tail -n 1) o> out.txt
hello
cat out.txt
world
I think the only reason that you see hello is because head and tail circumvent the pipeline and printing things themselves. I think if you make this into a nushell command you'll see that only the last thing in the pipeline produces an output.
However, this example seems wrong to me because nushell would be printing output multiple times in the pipeline, which hasn't been supported in a long time. Maybe this section of the docs is old? Is it possible I'm wrong and this is a regression? We'll have to wait and see what others think.
Activity
fdncred commentedon Feb 19, 2026
I think the only reason that you see
hellois becauseheadandtailcircumvent the pipeline and printing things themselves. I think if you make this into a nushell command you'll see that only the last thing in the pipeline produces an output.so nushell seems to behave consistently.
However, this example seems wrong to me because nushell would be printing output multiple times in the pipeline, which hasn't been supported in a long time. Maybe this section of the docs is old? Is it possible I'm wrong and this is a regression? We'll have to wait and see what others think.
Fix outdated output redirection docs
Fix outdated output redirection docs (#2200)