What is the name for `

This is called process substitution: Process substitution is a form of redirection where the input or output of a process (some sequence of commands) appear as a temporary file. Also from Bash Reference Manual → 3.5.6 Process Substitution: Process substitution allows a process’s input or output to be referred to using a filename. It takes … Read more

How to use redirection in C for file input

Using redirection sends the contents of the input file to stdin, so you need to read from stdin inside your code, so something like (error checking omitted for clarity) #include <stdio.h> #define BUFFERSIZE 100 int main (int argc, char *argv[]) { char buffer[BUFFERSIZE]; fgets(buffer, BUFFERSIZE , stdin); printf(“Read: %s”, buffer); return 0; }

What is /dev/null 2>&1?

>> /dev/null redirects standard output (stdout) to /dev/null, which discards it. (The >> seems sort of superfluous, since >> means append while > means truncate and write, and either appending to or writing to /dev/null has the same net effect. I usually just use > for that reason.) 2>&1 redirects standard error (2) to standard … Read more

Shell redirection i/o order

The Bash manual has a clear example (similar to yours) to show that the order matters and also explains the difference. Here’s the relevant part excerpted (emphasis mine): Note that the order of redirections is significant. For example, the command ls > dirlist 2>&1 directs both standard output (file descriptor 1) and standard error (file … Read more