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
Copy file name to clipboardExpand all lines: lang-guide/chapters/pipelines.md
+78-71Lines changed: 78 additions & 71 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,80 +84,87 @@ Also note that `complete` is special, it doesn't work with `e>|`, `o+e>|`.
84
84
85
85
## Stdio and redirection behavior examples
86
86
87
-
Pipeline and redirection behavior can be hard to follow when they are used with subexpressions, or custom commands. Here are some examples that show intended stdio behavior.
87
+
Pipeline and redirection behavior can be hard to follow when they are used with subexpressions, or custom commands. Here are some examples that show intended stdio behavior.
88
88
89
89
### Examples for subexpression
90
90
91
91
- (^cmd1 | ^cmd2; ^cmd3 | ^cmd4)
92
92
93
-
| Command | Stdout | Stderr |
94
-
| ------- | --------| ---------- |
95
-
| cmd1 | Piped | Terminal |
96
-
| cmd2 |*Terminal*| Terminal|
97
-
| cmd3 | Piped | Terminal |
98
-
| cmd4 | Terminal | Terminal |
93
+
| Command | Stdout | Stderr |
94
+
| ------- | ---------- |-------- |
95
+
| cmd1 | Piped | Terminal |
96
+
| cmd2 |_Terminal_| Terminal |
97
+
| cmd3 | Piped | Terminal |
98
+
| cmd4 | Terminal | Terminal |
99
99
100
100
- (^cmd1 | ^cmd2; ^cmd3 | ^cmd4) | ^cmd5
101
101
102
-
It runs `(^cmd1 | ^cmd2; ^cmd3 | ^cmd4)` first, then pipes *stdout* to `^cmd5`, where both stdout and stderr are directed to the Terminal.
102
+
It runs `(^cmd1 | ^cmd2; ^cmd3 | ^cmd4)` first, then pipes _stdout_ to `^cmd5`, where both stdout and stderr are directed to the Terminal.
103
103
104
-
| Command | Stdout | Stderr |
105
-
| ------- | --------| ---------- |
106
-
| cmd1 | Piped | Terminal |
107
-
| cmd2 |*Terminal*| Terminal|
108
-
| cmd3 | Piped | Terminal |
109
-
| cmd4 | Piped | Terminal |
104
+
| Command | Stdout | Stderr |
105
+
| ------- | ---------- |-------- |
106
+
| cmd1 | Piped | Terminal |
107
+
| cmd2 |_Terminal_| Terminal |
108
+
| cmd3 | Piped | Terminal |
109
+
| cmd4 | Piped | Terminal |
110
110
111
111
- (^cmd1 | ^cmd2; ^cmd3 | ^cmd4) e>| ^cmd5
112
112
113
-
It runs `(^cmd1 | ^cmd2; ^cmd3 | ^cmd4)` first, then pipes *stderr* to `^cmd5`, where both stdout and stderr are directed to the Terminal.
113
+
It runs `(^cmd1 | ^cmd2; ^cmd3 | ^cmd4)` first, then pipes _stderr_ to `^cmd5`, where both stdout and stderr are directed to the Terminal.
114
114
115
115
| Command | Stdout | Stderr |
116
116
| ------- | -------- | -------- |
117
117
| cmd1 | Piped | Terminal |
118
118
| cmd2 | Terminal | Terminal |
119
119
| cmd3 | Piped | Terminal |
120
-
| cmd4 | Terminal | Piped |
120
+
| cmd4 | Terminal | Piped |
121
121
122
122
- (^cmd1 | ^cmd2; ^cmd3 | ^cmd4) o+e>| ^cmd5
123
123
124
-
It runs `(^cmd1 | ^cmd2; ^cmd3 | ^cmd4)` first, then pipes *stdout and stderr* to `^cmd5`, where both stdout and stderr are directed to the Terminal.
124
+
It runs `(^cmd1 | ^cmd2; ^cmd3 | ^cmd4)` first, then pipes _stdout and stderr_ to `^cmd5`, where both stdout and stderr are directed to the Terminal.
125
125
126
126
| Command | Stdout | Stderr |
127
127
| ------- | -------- | -------- |
128
128
| cmd1 | Piped | Terminal |
129
129
| cmd2 | Terminal | Terminal |
130
130
| cmd3 | Piped | Terminal |
131
-
| cmd4 | Piped | Piped |
131
+
| cmd4 | Piped | Piped |
132
+
133
+
::: warning
134
+
135
+
Please note that the following 3 examples are currently broken due to a regression documented [issue #15326](https://github.com/nushell/nushell/issues/15326).
136
+
137
+
:::
132
138
133
139
- (^cmd1 | ^cmd2; ^cmd3 | ^cmd4) o> test.out
134
140
135
-
| Command | Stdout | Stderr |
136
-
| ------- | --------| -------- |
137
-
| cmd1 | Piped | Terminal |
138
-
| cmd2 | File | Terminal |
139
-
| cmd3 | Piped | Terminal |
140
-
| cmd4 | File | Terminal|
141
+
| Command | Stdout | Stderr |
142
+
| ------- | ------ | -------- |
143
+
| cmd1 | Piped | Terminal |
144
+
| cmd2 | File | Terminal |
145
+
| cmd3 | Piped | Terminal |
146
+
| cmd4 | File | Terminal |
141
147
142
148
- (^cmd1 | ^cmd2; ^cmd3 | ^cmd4) e> test.out
143
149
144
-
| Command | Stdout | Stderr |
145
-
| ------- | -------- | --------|
146
-
| cmd1 | Piped | File |
147
-
| cmd2 | Terminal | File |
148
-
| cmd3 | Piped | File |
149
-
| cmd4 | Terminal | File |
150
+
| Command | Stdout | Stderr |
151
+
| ------- | -------- | ------ |
152
+
| cmd1 | Piped | File |
153
+
| cmd2 | Terminal | File |
154
+
| cmd3 | Piped | File |
155
+
| cmd4 | Terminal | File |
150
156
151
157
- (^cmd1 | ^cmd2; ^cmd3 | ^cmd4) o+e> test.out
152
158
153
-
| Command | Stdout | Stderr|
154
-
| ------- | --------|-------- |
155
-
| cmd1 | Piped | File |
156
-
| cmd2 | File | File |
157
-
| cmd3 | Piped | File |
158
-
| cmd4 | File | File |
159
+
| Command | Stdout | Stderr |
160
+
| ------- | ------ | ------ |
161
+
| cmd1 | Piped | File|
162
+
| cmd2 | File | File|
163
+
| cmd3 | Piped | File|
164
+
| cmd4 | File | File |
159
165
160
166
### Examples for custom command
167
+
161
168
Given the following custom commands
162
169
163
170
```nu
@@ -173,69 +180,69 @@ In the examples below the body of `custom-cmd` is `(^cmd1 | ^cmd2; ^cmd3 | ^cmd4
173
180
174
181
- custom-cmd
175
182
176
-
| Command | Stdout | Stderr |
177
-
| ------- | --------| ---------- |
178
-
| cmd1 | Piped | Terminal |
179
-
| cmd2 |*Terminal*| Terminal|
180
-
| cmd3 | Piped | Terminal |
181
-
| cmd4 | Terminal | Terminal |
183
+
| Command | Stdout | Stderr |
184
+
| ------- | ---------- |-------- |
185
+
| cmd1 | Piped | Terminal |
186
+
| cmd2 |_Terminal_| Terminal |
187
+
| cmd3 | Piped | Terminal |
188
+
| cmd4 | Terminal | Terminal |
182
189
183
190
- custom-cmd | ^cmd5
184
191
185
-
It runs `custom-cmd` first, then pipes *stdout* to `^cmd5`, where both stdout and stderr are directed to the Terminal.
192
+
It runs `custom-cmd` first, then pipes _stdout_ to `^cmd5`, where both stdout and stderr are directed to the Terminal.
186
193
187
-
| Command | Stdout | Stderr |
188
-
| ------- | --------| ---------- |
189
-
| cmd1 | Piped | Terminal |
190
-
| cmd2 |*Terminal*| Terminal|
191
-
| cmd3 | Piped | Terminal |
192
-
| cmd4 | Piped | Terminal |
194
+
| Command | Stdout | Stderr |
195
+
| ------- | ---------- |-------- |
196
+
| cmd1 | Piped | Terminal |
197
+
| cmd2 |_Terminal_| Terminal |
198
+
| cmd3 | Piped | Terminal |
199
+
| cmd4 | Piped | Terminal |
193
200
194
201
- custom-cmd e>| ^cmd5
195
202
196
-
It runs `custom-cmd` first, then pipes *stderr* to `^cmd5`, where both stdout and stderr are directed to the Terminal.
203
+
It runs `custom-cmd` first, then pipes _stderr_ to `^cmd5`, where both stdout and stderr are directed to the Terminal.
197
204
198
205
| Command | Stdout | Stderr |
199
206
| ------- | -------- | -------- |
200
207
| cmd1 | Piped | Terminal |
201
208
| cmd2 | Terminal | Terminal |
202
209
| cmd3 | Piped | Terminal |
203
-
| cmd4 | Terminal | Piped |
210
+
| cmd4 | Terminal | Piped |
204
211
205
212
- custom-cmd o+e>| ^cmd5
206
213
207
-
It runs `custom-cmd` first, then pipes *stdout and stderr* to `^cmd5`, where both stdout and stderr are directed to the Terminal.
214
+
It runs `custom-cmd` first, then pipes _stdout and stderr_ to `^cmd5`, where both stdout and stderr are directed to the Terminal.
0 commit comments