Add normal pipes as a possible alternative

Jordan Christiansen
2021-09-01 11:10:08 -05:00
parent 01bf3d8bc4
commit 5999174bfc

@@ -39,6 +39,16 @@ rm "$tmp"
If streaming is important, the temporary file can be a named pipe, and the producer or consumer can be run as a background job. If streaming is important, the temporary file can be a named pipe, and the producer or consumer can be run as a background job.
If the reading command accepts input from standard input, the process substitution can be replaced with a regular pipe:
```sh
#!/bin/sh
program | while IFS= read -r n
do
sum=$((sum+n))
done
```
### Rationale: ### Rationale:
Process substitution is a ksh and bash extension. It does not work in sh or dash scripts. Process substitution is a ksh and bash extension. It does not work in sh or dash scripts.