I am wondering if it is possible to send multiple pipes lets say 3 as arguments to be merged with sort -m in c.
For example execvp("sort", "sort", "-m", pipe1_read_end, pipe2_read_end, NULL)
If this is only targeting Linux, you can pass strings of the form:
/dev/fd/<number>
...representing your pipes, where <number>
is, of course, the FD table entry number for the file descriptor in question. In fact, bash does this itself if you run
sort -m <(something) <(something)
For a more OS-agnostic solution, one typically uses named FIFOs (and this is what bash does with the <()
construct if it detects that it's on an operating system that doesn't provide /dev/fd/
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.