Bash & Shell Scripting (50 Qs)•Part 3: Advanced Text Processing & Production Internals (Senior / Lead)
Process Substitution (`<()`, `>()`) vs Named Pipes (`mkfifo`): Syntax and use cases.
senior LevelCode ExamplePipes
In Simple Words:
Process substitution allows the standard output or input of a command to appear as a temporary file descriptor (/dev/fd/63), avoiding intermediate temporary files on disk:
bash
# Compare the output of two remote APIs directly using diff
diff -u <(curl -s https://api.v1.com/users) <(curl -s https://api.v2.com/users)
# Split stdout stream to two different consumers simultaneously
tar -cf - ./data | tee >(gzip > data.tar.gz) >(bzip2 > data.tar.bz2) > /dev/null